Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Discovery fails with E ModuleNotFoundError: No module named #10005

Closed
zePanzerfaust opened this issue Feb 9, 2020 · 12 comments
Closed

Test Discovery fails with E ModuleNotFoundError: No module named #10005

zePanzerfaust opened this issue Feb 9, 2020 · 12 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@zePanzerfaust
Copy link

zePanzerfaust commented Feb 9, 2020

Environment data

Version: 1.42.0
Commit: ae08d5460b5a45169385ff3fd44208f431992451
Date: 2020-02-06T10:51:33.119Z
Electron: 6.1.6
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 19.3.0

ms-python.python-2020.1.58038
Python 3.8.1
pytest 5.3.2

Expected behaviour

Test discovery finds tests and I'm able to run/debug them

Actual behaviour

Test discovery fails with "E ModuleNotFoundError: No module named 'mymodule'"

Steps to reproduce:

Project setup like this

.
├── mymodule
│   ├── __init__.py
│   ├── ...
├── tests
│   ├── __init__.py
│   ├── ...
├── requirements.txt
├── setup.py
...

Discovering tests using the command ">Python: Discover Tests"

python /<...>/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir /path/to/root/of/project -s --cache-clear tests

Fails with "E ModuleNotFoundError: No module named 'mymodule'"

Manual run with the following works fine

python -m pytest --rootdir /path/to/root/of/project -s --cache-clear tests

Difference describe here in the first section

https://docs.pytest.org/en/latest/usage.html#cmdline

But I'd prefer not to change sys.path manually if not necessary

PyCharm with the same project and venv works fine and without the need to modify anything.

@zePanzerfaust zePanzerfaust added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Feb 9, 2020
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Feb 11, 2020
@ericsnowcurrently
Copy link
Member

@zePanzerfaust, thanks for letting us know about this. We'll take a look as soon as we can.

@ericsnowcurrently
Copy link
Member

Test discovery should definitely be working for you. I was not able to reproduce the problem. I set up the following in my project:

.
├── mymodule
│   ├── __init__.py
│   ├── spam.py
├── tests
│   ├── __init__.py
│   ├── test_spam.py

# spam.py
def spam():
    return 42

# test_spam.py
from mymodule import spam
def test_spam():
    res = spam.spam()
    assert(res == 42)

# .vscode/settings.json
{
    "python.testing.pytestArgs": [
        "tests"
    ],
    "python.testing.unittestEnabled": false,
    "python.testing.nosetestsEnabled": false,
    "python.testing.pytestEnabled": true
}

With the above test discovery worked fine.

So let's figure out what's going on. Please provide the content of your settings.json. Likewise for the "Python" output panel and the "Python test log" output panel. Also, do you have any pytest customizations (e.g. pytest.cfg)? Thanks!

@ericsnowcurrently ericsnowcurrently added the info-needed Issue requires more information from poster label Feb 12, 2020
@omershtivi1
Copy link

omershtivi1 commented Feb 13, 2020

Hi,
I've the same issue too.
Vscode version: 1.42
Python version 3.6.5
pytest==5.3.5

Settings:
{
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "git.autofetch": true,
    "python.jediEnabled": false,
    "java.configuration.checkProjectSettingsExclusions": false,
    "gitlab.ignoreCertificateErrors": true,
    "[python]": {},
    "python.testing.pytestEnabled": true,
    "python.linting.pylintCategorySeverity.refactor": "Warning",
    "python.linting.pylintCategorySeverity.convention": "Warning",
    "python.linting.pylamaEnabled": true
}
Python test log:
python /Users/omer.shtivi/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir /Users/omer.shtivi/PycharmProjects/netops-cm -s .
Test Discovery failed: 
Error: ============================= test session starts ==============================
platform darwin -- Python 3.6.5, pytest-5.3.5, py-1.8.0, pluggy-0.13.0
rootdir: /Users/omer.shtivi/PycharmProjects/netops-cm
plugins: pylama-7.7.1, cov-2.8.1
collected 0 items / 9 errors

==================================== ERRORS ====================================
__________ ERROR collecting tests/pillar/common/test_idle_timeout.py ___________
ImportError while importing test module '/Users/omer.shtivi/PycharmProjects/netops-cm/tests/pillar/common/test_idle_timeout.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/pillar/common/test_idle_timeout.py:3: in <module>
    from tests.pillar.pillar_test_helpers.generic import PILLAR_ROOT
E   ModuleNotFoundError: No module named 'tests.pillar'
______________ ERROR collecting tests/pillar/common/test_init.py _______________
ImportError while importing test module '/Users/omer.shtivi/PycharmProjects/netops-cm/tests/pillar/common/test_init.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/pillar/common/test_init.py:3: in <module>
    from tests.pillar.pillar_test_helpers.generic import PILLAR_ROOT
E   ModuleNotFoundError: No module named 'tests.pillar'
______________ ERROR collecting tests/pillar/common/test_ldap.py _______________
ImportError while importing test module '/Users/omer.shtivi/PycharmProjects/netops-cm/tests/pillar/common/test_ldap.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/pillar/common/test_ldap.py:3: in <module>
    from tests.pillar.pillar_test_helpers.generic import PILLAR_ROOT
E   ModuleNotFoundError: No module named 'tests.pillar'
__________ ERROR collecting tests/pillar/common/test_login_classes.py __________
ImportError while importing test module '/Users/omer.shtivi/PycharmProjects/netops-cm/tests/pillar/common/test_login_classes.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/pillar/common/test_login_classes.py:3: in <module>
    from tests.pillar.pillar_test_helpers.generic import PILLAR_ROOT
E   ModuleNotFoundError: No module named 'tests.pillar'
___________ ERROR collecting tests/pillar/common/test_login_users.py ___________
ImportError while importing test module '/Users/omer.shtivi/PycharmProjects/netops-cm/tests/pillar/common/test_login_users.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/pillar/common/test_login_users.py:3: in <module>
    from tests.pillar.pillar_test_helpers.generic import PILLAR_ROOT
E   ModuleNotFoundError: No module named 'tests.pillar'
__________ ERROR collecting tests/pillar/common/test_name_servers.py ___________
ImportError while importing test module '/Users/omer.shtivi/PycharmProjects/netops-cm/tests/pillar/common/test_name_servers.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/pillar/common/test_name_servers.py:3: in <module>
    from tests.pillar.pillar_test_helpers.generic import PILLAR_ROOT
E   ModuleNotFoundError: No module named 'tests.pillar'
______________ ERROR collecting tests/pillar/common/test_snmp.py _______________
ImportError while importing test module '/Users/omer.shtivi/PycharmProjects/netops-cm/tests/pillar/common/test_snmp.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/pillar/common/test_snmp.py:3: in <module>
    from tests.pillar.pillar_test_helpers.generic import PILLAR_ROOT
E   ModuleNotFoundError: No module named 'tests.pillar'
_____________ ERROR collecting tests/pillar/common/test_syslog.py ______________
ImportError while importing test module '/Users/omer.shtivi/PycharmProjects/netops-cm/tests/pillar/common/test_syslog.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/pillar/common/test_syslog.py:3: in <module>
    from tests.pillar.pillar_test_helpers.generic import PILLAR_ROOT
E   ModuleNotFoundError: No module named 'tests.pillar'
___________ ERROR collecting tests/pillar/common/test_vault_roles.py ___________
ImportError while importing test module '/Users/omer.shtivi/PycharmProjects/netops-cm/tests/pillar/common/test_vault_roles.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/pillar/common/test_vault_roles.py:3: in <module>
    from tests.pillar.pillar_test_helpers.generic import PILLAR_ROOT
E   ModuleNotFoundError: No module named 'tests.pillar'
!!!!!!!!!!!!!!!!!!! Interrupted: 9 errors during collection !!!!!!!!!!!!!!!!!!!!
============================== 9 errors in 1.55s ===============================

Traceback (most recent call last):
  File "/Users/omer.shtivi/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py", line 18, in <module>
    main(tool, cmd, subargs, toolargs)
  File "/Users/omer.shtivi/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/adapter/__main__.py", line 90, in main
    parents, result = run(toolargs, **subargs)
  File "/Users/omer.shtivi/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/adapter/pytest/_discovery.py", line 35, in discover
    raise Exception('pytest discovery failed (exit code {})'.format(ec))
Exception: pytest discovery failed (exit code 2)
Python Output:
User belongs to experiment group 'ShowPlayIcon - start'
User belongs to experiment group 'ShowExtensionSurveyPrompt - control'
User belongs to experiment group 'DebugAdapterFactory - experiment'
User belongs to experiment group 'PtvsdWheels37 - experiment'
User belongs to experiment group 'UseTerminalToGetActivatedEnvVars - control'
User belongs to experiment group 'AA_testing - experiment'
User belongs to experiment group 'WebHostNotebook - control'
> conda --version
> pyenv root
> python3.7 -c "import sys;print(sys.executable)"
> python3.6 -c "import sys;print(sys.executable)"
> python3 -c "import sys;print(sys.executable)"
> python2 -c "import sys;print(sys.executable)"
> python -c "import sys;print(sys.executable)"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import sys;print(sys.executable)"
> conda info --json
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3-32 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3-32 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/bin/python ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/bin/python ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3-32 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3-32 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/bin/python2.7 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/bin/python2.7 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /Applications/dev/play-1.3/python ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /Applications/dev/play-1.3/python ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3-32 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3-32 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.6 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.6 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.6 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3.6 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/bin/python ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/bin/python ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/bin/python2.7 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/bin/python2.7 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/bin/python ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /usr/bin/python ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
Starting Microsoft Python language server.
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm
> conda --version
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pytest"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pytest"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pytest"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pytest"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import python -m pytest"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import python -m pytest"
> conda info --json
> conda --version
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pip"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pip"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import python -m pytest"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import python -m pytest"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import python -m pytest"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import python -m pytest"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pytest"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pytest"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_idle_timeout.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_idle_timeout.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pylama"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pylama"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pylama"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pylama"

Linter 'pylama' is not installed. Please install it or select another linter".
Error: Module 'pylama' not installed.
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pytest"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pytest"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pip"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pip"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pylama"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pylama"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pytest"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pytest"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_idle_timeout.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_idle_timeout.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_idle_timeout.py:26:34: [W] W292 no newline at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_init.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_init.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_init.py:11:1: [W] W391 blank line at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_init.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_init.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_init.py:5:1: [C] E302 expected 2 blank lines, found 1 [pycodestyle]
tests/pillar/common/test_init.py:9:1: [W] W391 blank line at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_ldap.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_ldap.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_ldap.py:26:56: [W] W292 no newline at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_ldap.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_ldap.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_ldap.py:25:56: [W] W292 no newline at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_login_classes.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_login_classes.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_login_classes.py:11:1: [W] W391 blank line at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_login_classes.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_login_classes.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_login_classes.py:10:1: [W] W391 blank line at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_name_servers.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_name_servers.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_name_servers.py:11:1: [W] W391 blank line at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_login_users.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_login_users.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_login_users.py:11:1: [W] W391 blank line at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_login_users.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_login_users.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_login_users.py:10:1: [W] W391 blank line at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_name_servers.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_name_servers.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_name_servers.py:11:1: [W] W391 blank line at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_name_servers.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_name_servers.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_name_servers.py:10:1: [W] W391 blank line at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_snmp.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_snmp.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_snmp.py:11:1: [W] W391 blank line at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_snmp.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_snmp.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_snmp.py:10:1: [W] W391 blank line at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_syslog.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_syslog.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_syslog.py:11:1: [W] W391 blank line at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_syslog.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_syslog.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_syslog.py:10:1: [W] W391 blank line at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_vault_roles.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_vault_roles.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_vault_roles.py:11:1: [W] W391 blank line at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_vault_roles.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_vault_roles.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_vault_roles.py:10:1: [W] W391 blank line at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pytest"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pytest"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/pillar_test_helpers/generic.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/pillar_test_helpers/generic.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/pillar_test_helpers/generic.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/pillar_test_helpers/generic.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
##########Linting Output - pylama##########
tests/pillar/pillar_test_helpers/generic.py:4:80: [W] W292 no newline at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/salt/_modules/users_ldap.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/salt/_modules/users_ldap.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
salt/_modules/users_ldap.py:5:80: [C] E501 line too long (418 > 79 characters) [pycodestyle]
salt/_modules/users_ldap.py:7:1: [C] E302 expected 2 blank lines, found 1 [pycodestyle]
salt/_modules/users_ldap.py:8:1: [E] E0602 undefined name '__salt__' [pyflakes]
salt/_modules/users_ldap.py:39:80: [C] E501 line too long (80 > 79 characters) [pycodestyle]
salt/_modules/users_ldap.py:39:43: [C] E231 missing whitespace after ':' [pycodestyle]
salt/_modules/users_ldap.py:42:80: [C] E501 line too long (94 > 79 characters) [pycodestyle]
salt/_modules/users_ldap.py:42:81: [C] E203 whitespace before ',' [pycodestyle]
salt/_modules/users_ldap.py:42:82: [C] E231 missing whitespace after ',' [pycodestyle]
salt/_modules/users_ldap.py:60:80: [C] E501 line too long (83 > 79 characters) [pycodestyle]
salt/_modules/users_ldap.py:60:1: [C] E302 expected 2 blank lines, found 1 [pycodestyle]
salt/_modules/users_ldap.py:73:1: [W] W391 blank line at end of file [pycodestyle]
salt/_modules/users_ldap.py:73:1: [W] W293 blank line contains whitespace [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m datascience.daemon --daemon-module=datascience.jupyter_daemon -v
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m datascience.daemon --daemon-module=datascience.jupyter_daemon -v
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m datascience.daemon --daemon-module=datascience.jupyter_daemon -v
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m datascience.daemon --daemon-module=datascience.jupyter_daemon -v
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m datascience.daemon --daemon-module=datascience.jupyter_daemon -v
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m datascience.daemon --daemon-module=datascience.jupyter_daemon -v
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 (daemon) -m jupyter notebook --version
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m jupyter notebook --version
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m jupyter notebook --version
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import jupyter"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import jupyter"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 (daemon) -m notebook --version
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m notebook --version
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m notebook --version
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import notebook"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import notebook"
> /usr/bin/python -m jupyter notebook --version
> /usr/bin/python -m jupyter notebook --version
> /usr/local/bin/python3 -m jupyter notebook --version
> /usr/local/bin/python3 -m jupyter notebook --version
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 (daemon) -m jupyter notebook --version
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m jupyter notebook --version
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m jupyter notebook --version
> /usr/bin/python -c "import jupyter"
> /usr/bin/python -c "import jupyter"
> /usr/local/bin/python3 -c "import jupyter"
> /usr/local/bin/python3 -c "import jupyter"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import jupyter"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import jupyter"
> /usr/bin/python -m notebook --version
> /usr/bin/python -m notebook --version
> /usr/local/bin/python3 -m notebook --version
> /usr/local/bin/python3 -m notebook --version
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 (daemon) -m notebook --version
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m notebook --version
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m notebook --version
> /usr/bin/python -c "import notebook"
> /usr/bin/python -c "import notebook"
> /usr/local/bin/python3 -c "import notebook"
> /usr/local/bin/python3 -c "import notebook"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import notebook"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import notebook"
> jupyter notebook --version
Starting Microsoft Python language server.
Starting Microsoft Python language server.
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/Downloads/test_trunk_pipes.py
cwd: ~/Downloads
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/Downloads/test_trunk_pipes.py
cwd: ~/Downloads
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/Downloads/test_trunk_pipes.py
cwd: ~/Downloads
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/Downloads/test_trunk_pipes.py
cwd: ~/Downloads
##########Linting Output - pylama##########
##########Linting Output - pylama##########
test_trunk_pipes.py:4:80: [C] E501 line too long (99 > 79 characters) [pycodestyle]
test_trunk_pipes.py:9:80: [C] E501 line too long (82 > 79 characters) [pycodestyle]
test_trunk_pipes.py:10:1: [E] E0602 undefined name 'pop_name' [pyflakes]
test_trunk_pipes.py:11:1: [W] W391 blank line at end of file [pycodestyle]
test_trunk_pipes.py:11:1: [W] W293 blank line contains whitespace [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/Downloads/test_trunk_pipes.py
cwd: ~/Downloads
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/Downloads/test_trunk_pipes.py
cwd: ~/Downloads
##########Linting Output - pylama##########
test_trunk_pipes.py:4:80: [C] E501 line too long (99 > 79 characters) [pycodestyle]
test_trunk_pipes.py:9:80: [C] E501 line too long (82 > 79 characters) [pycodestyle]
test_trunk_pipes.py:10:1: [E] E0602 undefined name 'pop_name' [pyflakes]
test_trunk_pipes.py:11:1: [W] W391 blank line at end of file [pycodestyle]
test_trunk_pipes.py:11:1: [W] W293 blank line contains whitespace [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/Downloads/test_trunk_pipes.py
cwd: ~/Downloads
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/Downloads/test_trunk_pipes.py
cwd: ~/Downloads
##########Linting Output - pylama##########
test_trunk_pipes.py:4:80: [C] E501 line too long (99 > 79 characters) [pycodestyle]
test_trunk_pipes.py:9:80: [C] E501 line too long (82 > 79 characters) [pycodestyle]
test_trunk_pipes.py:11:1: [W] W391 blank line at end of file [pycodestyle]
test_trunk_pipes.py:11:1: [W] W293 blank line contains whitespace [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/Downloads/test_trunk_pipes.py
cwd: ~/Downloads
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/Downloads/test_trunk_pipes.py
cwd: ~/Downloads
##########Linting Output - pylama##########
test_trunk_pipes.py:4:80: [C] E501 line too long (99 > 79 characters) [pycodestyle]
test_trunk_pipes.py:10:1: [W] W391 blank line at end of file [pycodestyle]
test_trunk_pipes.py:10:1: [W] W293 blank line contains whitespace [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/Downloads/test_trunk_pipes.py
cwd: ~/Downloads
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/Downloads/test_trunk_pipes.py
cwd: ~/Downloads
##########Linting Output - pylama##########
test_trunk_pipes.py:4:80: [C] E501 line too long (99 > 79 characters) [pycodestyle]
test_trunk_pipes.py:10:1: [W] W391 blank line at end of file [pycodestyle]
test_trunk_pipes.py:10:1: [W] W293 blank line contains whitespace [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_chassis.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_chassis.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_chassis.py:1:1: [W] W0611 'yaml' imported but unused [pyflakes]
tests/pillar/common/test_chassis.py:7:1: [C] E302 expected 2 blank lines, found 1 [pycodestyle]
tests/pillar/common/test_chassis.py:14:9: [W] W292 no newline at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_chassis.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_chassis.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_chassis.py:1:1: [W] W0611 'yaml' imported but unused [pyflakes]
tests/pillar/common/test_chassis.py:3:1: [W] W0611 'jinja2.Template' imported but unused [pyflakes]
tests/pillar/common/test_chassis.py:7:1: [C] E302 expected 2 blank lines, found 1 [pycodestyle]
tests/pillar/common/test_chassis.py:17:31: [W] W292 no newline at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_chassis.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_chassis.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_chassis.py:1:1: [W] W0611 'yaml' imported but unused [pyflakes]
tests/pillar/common/test_chassis.py:3:1: [W] W0611 'jinja2.Template' imported but unused [pyflakes]
tests/pillar/common/test_chassis.py:7:1: [C] E302 expected 2 blank lines, found 1 [pycodestyle]
tests/pillar/common/test_chassis.py:18:1: [C] E305 expected 2 blank lines after class or function definition, found 0 [pycodestyle]
tests/pillar/common/test_chassis.py:19:22: [W] W292 no newline at end of file [pycodestyle]
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/interpreterInfo.py
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/platform/platform/libplatform/portal/settings.py
cwd: ~/PycharmProjects/platform
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/platform/platform/libplatform/portal/settings.py
cwd: ~/PycharmProjects/platform
Starting Microsoft Python language server.
##########Linting Output - pylama##########
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_chassis.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_chassis.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_chassis.py:1:1: [W] W0611 'yaml' imported but unused [pyflakes]
tests/pillar/common/test_chassis.py:3:1: [W] W0611 'jinja2.Template' imported but unused [pyflakes]
tests/pillar/common/test_chassis.py:7:1: [C] E302 expected 2 blank lines, found 1 [pycodestyle]
tests/pillar/common/test_chassis.py:16:1: [C] E265 block comment should start with '# ' [pycodestyle]
tests/pillar/common/test_chassis.py:19:1: [C] E265 block comment should start with '# ' [pycodestyle]
tests/pillar/common/test_chassis.py:20:23: [W] W292 no newline at end of file [pycodestyle]

@ericsnowcurrently
Copy link
Member

@omershtivi1, thanks for the info. Keep in mind that while the outcome may be the same (ModuleNotFoundError), the cause may be different. Let's continue under the assumption that it is the same problem. If it turns out be something else then at that point we'll ask you to open a separate issue (for now there's no need).

As to the info you gave us above, it looks like you put the content of you user settings.json. Please also provide your workspace settings.json (/Users/omer.shtivi/PycharmProjects/netops-cm/.vscode/settings.json).

I've also looked through the logs you provided and left a number of questions (and observations) below. In summary:

  • there is some correlation between pytest discovery and pylama, but it's unlikely to relate to the problem
  • the pytest command arguments are as expected and all seem to be correct
  • pytest plugins could be related, but it's unlikely

Python test log

python /Users/omer.shtivi/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir /Users/omer.shtivi/PycharmProjects/netops-cm -s .
Test Discovery failed:
Error: ============================= test session starts ==============================
platform darwin -- Python 3.6.5, pytest-5.3.5, py-1.8.0, pluggy-0.13.0
rootdir: /Users/omer.shtivi/PycharmProjects/netops-cm
plugins: pylama-7.7.1, cov-2.8.1

This tells us how pytest was run. The adapter script the extension used is just a wrapper around pytest, which prints out a JSON summary of the discovered tests (which the extension consumes via stdout). The equivalent direct commands would be:

cd ~/PycharmProjects/netops-cm
/Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pytest --rootdir /Users/omer.shtivi/PycharmProjects/netops-cm -s .

What happens when you run that in your terminal? The output matters. As noted, the extension expects the adapter script to only produce the JSON results, so any unexpected text will cause a problem. (The logs do not indicate a problem with that, but it's worth checking.)

The "." at the end of the command is the directory where pytest will start looking for tests. What happens if you change it to "tests"? You can do so by putting the following in your settings.json:

    "python.testing.pytestArgs": [
        "tests"
    ],

The logs indicate you are using the latest version of pytest. Do you have this problem with earlier versions (e.g. 5.3.2, 5.1.3)? When did the problem start happening?

The logs show that "rootdir" matches the command argument (which is your workspace root, right?). That is expected.

The logs also indicate that you are using the "pylama" and "cov" pytest plugins. How did you enable them? What happens if you disable them? Also, what is in your pytest configuration?

That's pretty much everything the test log tells us.

Python Output

The "Python output panel provides a few more bits of useful information. As you'll notice, I'm wondering if the problem is related to pylama. (It very well might not be related.)

User belongs to experiment group 'ShowPlayIcon - start'
User belongs to experiment group 'ShowExtensionSurveyPrompt - control'
User belongs to experiment group 'DebugAdapterFactory - experiment'
User belongs to experiment group 'PtvsdWheels37 - experiment'
User belongs to experiment group 'UseTerminalToGetActivatedEnvVars - control'
User belongs to experiment group 'AA_testing - experiment'
User belongs to experiment group 'WebHostNotebook - control'

These are the "experiments" you were randomly selected to be in. None of them are relevant to this issue though.

...
Starting Microsoft Python language server.

The language server provides things like code completion and navigation. It shouldn't impact pytest discovery though.

> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm

This is the first time test discovery is attempted. It matches all the other attempts and looks correct. Do you know if you were already seeing the problem at this point?

...
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pylama"

Linter 'pylama' is not installed. Please install it or select another linter".
Error: Module 'pylama' not installed.

This is the first time the extension tried to lint your code (either because you just configured pylama or because you just saved a file or otherwise triggered the command). The extension could not find pylama. I expect it popped up a dialog asking if you wanted to install pylama.

...
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pip"
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -c "import pylama"

This is roughly where pylama was installed.

...
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s --cache-clear .
cwd: ~/PycharmProjects/netops-cm

The test discovery has changed at this point (nor will it later).

...
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_idle_timeout.py
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_idle_timeout.py:26:34: [W] W292 no newline at end of file [pycodestyle]

This is the first time pylama runs after it was installed. Note that it was able to find a module a few levels deep under the top-level "tests" directory.

...
##########Linting Output - pylama##########
salt/_modules/users_ldap.py:5:80: [C] E501 line too long (418 > 79 characters) [pycodestyle]

This is the first place we see that pylama was able to find a module under a different top-level directory than "tests". (Salt is a pretty cool project, BTW. 😄)

...
> jupyter notebook --version

Here we see that you started up the interactive window. That shouldn't have an impact on pytest discovery though.

...
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pylama --format=parsable ~/PycharmProjects/netops-cm/tests/pillar/common/test_chassis.py
cwd: ~/PycharmProjects/netops-cm
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 ~/.vscode/extensions/ms-python.python-2020.1.58038/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/PycharmProjects/netops-cm -s .
cwd: ~/PycharmProjects/netops-cm
##########Linting Output - pylama##########
tests/pillar/common/test_chassis.py:1:1: [W] W0611 'yaml' imported but unused [pyflakes]
tests/pillar/common/test_chassis.py:3:1: [W] W0611 'jinja2.Template' imported but unused [pyflakes]
tests/pillar/common/test_chassis.py:7:1: [C] E302 expected 2 blank lines, found 1 [pycodestyle]
tests/pillar/common/test_chassis.py:16:1: [C] E265 block comment should start with '# ' [pycodestyle]
tests/pillar/common/test_chassis.py:19:1: [C] E265 block comment should start with '# ' [pycodestyle]
tests/pillar/common/test_chassis.py:20:23: [W] W292 no newline at end of file [pycodestyle]

This is the last time (in the log) that test discovery is attempted. It should correspond to the output you provided from the "Python test log". (It's also the last time pylama is run, but there doesn't seem to be much correlation with pytest problems.)

@ericsnowcurrently
Copy link
Member

There's also one specific thing you can do that may be helpful. In one of your test files put the following code:

import sys
print(sys.path)

Then during test discovery (which may fail due to unexpected output) you should see the module search path in your "Python test log" output. If that doesn't happen then put this instead (and look at the file):

import sys
with open('/tmp/python-sys-path.txt', 'w') as outfile:
    outfile.write(str(sys.path))

@omershtivi1
Copy link

Hi,
Here is the output for the print sys:

['/Users/omer.shtivi/PycharmProjects/netops-cm/tests/pillar/common', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload', '/Users/omer.shtivi/Library/Python/3.6/lib/python/site-packages', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages']

I will start doing the other checks

@omershtivi1
Copy link

Settings file:

mbp-172770:netops-cm omer.shtivi$ cat /Users/omer.shtivi/PycharmProjects/netops-cm/.vscode/settings.json
{
    "files.exclude": {
        "**/.classpath": true,
        "**/.project": true,
        "**/.settings": true,
        "**/.factorypath": true
    },
    "python.pythonPath": "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3",
    "python.testing.pytestArgs": [
        "."
    ],
    "python.testing.unittestEnabled": false,
    "python.testing.nosetestsEnabled": false,
    "python.testing.pytestEnabled": true

/Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pytest --rootdir /Users/omer.shtivi/PycharmProjects/netops-cm -s .
All good.

mbp-172770:netops-cm omer.shtivi$ /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -m pytest --rootdir /Users/omer.shtivi/PycharmProjects/netops-cm -s .
================================================================================================================= test session starts ==================================================================================================================
platform darwin -- Python 3.6.5, pytest-5.3.5, py-1.8.0, pluggy-0.13.0
rootdir: /Users/omer.shtivi/PycharmProjects/netops-cm
plugins: pylama-7.7.1, cov-2.8.1
collecting 0 items                                                                                                                                                                                                                                     ['/Users/omer.shtivi/PycharmProjects/netops-cm/tests/pillar', '/Users/omer.shtivi/PycharmProjects/netops-cm/omer_tmp/scripts', '', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload', '/Users/omer.shtivi/Library/Python/3.6/lib/python/site-packages', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages']
collected 10 items                                                                                                                                                                                                                                     

tests/pillar/common/test_idle_timeout.py ...
tests/pillar/common/test_init.py .
tests/pillar/common/test_login_classes.py .
tests/pillar/common/test_login_users.py .
tests/pillar/common/test_name_servers.py .
tests/pillar/common/test_snmp.py .
tests/pillar/common/test_syslog.py .
tests/pillar/common/test_vault_roles.py .
"python.testing.pytestArgs": [
        "tests"
    ],

Same error:

ModuleNotFoundError: No module named 'tests.pillar'

Earlier version:
Didn't check I will take a look

I don't have configuration for pytest (:
I use coverage for other projects.

@ericsnowcurrently
Copy link
Member

Any idea how '/Users/omer.shtivi/PycharmProjects/netops-cm/tests/pillar/common' got into your sys.path? It should have been'/Users/omer.shtivi/PycharmProjects/netops-cm.

@omershtivi1
Copy link

No clue.
Is there a way to restart the sys.path?

@ericsnowcurrently
Copy link
Member

That sort of manipulation of sys.path is fragile and best avoided. The best solution is to figure out why sys.path[0] is getting changed. Do you have any files that refer to "sys.path"?

@zePanzerfaust
Copy link
Author

Ok I feel a bit bad. It was a missing __init__.py in a subdirectory of the tests folder.
After adding that, the remaining errors were either because of wrong implementation or it searched *_test.py files in the wrong folder.
That got fixed by adding as you mentioned earlier

"python.testing.pytestArgs": [
	"tests/unit"
]

to the settings.json

Now the test discovery works.
(When trying some stuff, make sure to delete .pytest_cache and __pycache__, just in case :))

@ghost ghost removed the triage label Feb 22, 2020
@ericsnowcurrently
Copy link
Member

@zePanzerfaust, well, I'm glad you were able to sort it out. 😄

@lock lock bot locked as resolved and limited conversation to collaborators Mar 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants