Skip to content

pytest fails module not found, even tho tests are discovered & works in debug,  #15398

@mikofski

Description

@mikofski

Thank you for your help! I have search many issues, and tried many solutions, but I can't figure it out. I understand this is OSS, and no one may have time or interest to help me. That's okay. I am very grateful for vscode-python, and appreciate your time.

We have written the needed data into your cl

  • VS Code Version: 1.53.2
  • OS Version: Windows 10.0.17763
  • Python: 3.6.9 from python.org, running in venv
  • pytest 6.2.2

Version: 1.53.2 (user setup)
Commit: 622cb03f7e070a9670c94bae1a45d78d7181fbd4
Date: 2021-02-11T11:48:04.245Z
Electron: 11.2.1
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 10.0.17763

Steps to Reproduce:

  1. use python 3.6 to create a virtualenv: $py -3.6 -m venv venv
  2. install requirements for pvlib and install pvlib in editable mode: pip install --no-deps -e .
  3. open pvlib folder in vscode, it chooses venv automatically, yay!
  4. see test are all discovered
  5. try to run tests, select pytest as test runner, use default setup.cfg as only setting
  6. pick any test and run it, but it fails to import pvlib in conftest.py
ImportError while loading conftest 'c:\Users\mikm\Projects\pvlib-python\pvlib\tests\conftest.py'.
pvlib\tests\conftest.py:10: in <module>
    import pvlib
E   ModuleNotFoundError: No module named 'pvlib'
Error: TypeError: Cannot read property 'testsuites' of null
  1. run the same test again using debug, and it works!
  2. try it in the console or a windows CMD, and it works! (venv) $ pytest pvlib/tests/test_infinite_sheds.py::test_gcr_prime

Does this issue occur when all extensions are disabled?: Yes/No

If I disable extensions, then the Python extension isn't loaded, and so no tests are discovered, and so I can't run them.

I have the following extensions installed and enabled: Python, Remote-WSL, Jupyter, Git History, C#, and C/C++

If I disable everything but Python and Jupyter (I cannot disable only Jupyter), the tests are still discovered, but still do not run.

Related Issues

Metadata

Metadata

Assignees

Labels

area-testingbugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from poster

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions