Cannot discover with pytest in 2020-01
See original GitHub issueEnvironment data
- VS Code version: 1.41.1
- Extension version (available under the Extensions sidebar): 2020.1.57204 (6 January 2020)
- OS and version: windows 10
- Python version (& distribution if applicable, e.g. Anaconda): python 3.7.5
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): conda
- Relevant/affected Python packages and their versions: pytest version 5.3.2
- Jedi or Language Server? (i.e. what is
"python.jediEnabled"
set to; more info #3977): Language Server
Expected behaviour
The test are discovered
Actual behaviour
Since updating to the version 2020.1 I have the following two problems when discovering the tests with pytest:
- The base environment does not have pytest installed, using a different environment with pytest installed I get the following output:
python c:\Users\Federico\.vscode\extensions\ms-python.python-2020.1.57204\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir c:\Users\Federico\Documents\GitHub\pytest-error -s --cache-clear
Test Discovery failed:
Error: The system cannot find the path specified.
Traceback (most recent call last):
File "c:\Users\Federico\.vscode\extensions\ms-python.python-2020.1.57204\pythonFiles\testing_tools\run_adapter.py", line 13, in <module>
from testing_tools.adapter.__main__ import parse_args, main
File "c:\Users\Federico\.vscode\extensions\ms-python.python-2020.1.57204\pythonFiles\testing_tools\adapter\__main__.py", line 9, in <module>
from . import pytest, report
File "c:\Users\Federico\.vscode\extensions\ms-python.python-2020.1.57204\pythonFiles\testing_tools\adapter\pytest\__init__.py", line 7, in <module>
from ._discovery import discover
File "c:\Users\Federico\.vscode\extensions\ms-python.python-2020.1.57204\pythonFiles\testing_tools\adapter\pytest\_discovery.py", line 8, in <module>
import pytest
ModuleNotFoundError: No module named 'pytest'
- with pytest installed in the base environment (using the base envornment or any other with pytest) I get the following error
python c:\Users\Federico\.vscode\extensions\ms-python.python-2020.1.57204\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir c:\Users\Federico\Documents\GitHub\pytest-error -s --cache-clear
Test Discovery failed:
Error: The system cannot find the path specified.
Steps to reproduce:
- create a base environment, do no install pytest
- create a different environmnet, install pytest
- Clone the repo https://github.com/CaselIT/vscode-python-pytest-error
- open in vscode and select the environment with pytest installed
- should get the first error
- try installing pytest in the base environment
- should get the second error
Issue Analytics
- State:
- Created 4 years ago
- Comments:16
Top Results From Across the Web
pytest cannot find module - python - Stack Overflow
What happens here: when pytest discovers a conftest.py , it modifies sys.path so it can import stuff from the conftest module. So, since...
Read more >Why does PyCharm not run pytest testing for my application?
I'm new to pytest and am trying to write testing modules for my application. My directory structure is: broker/ broker/tests...
Read more >Changelog — pytest documentation
This is a fix to match a similar change made to test collection itself in pytest 6.0 (see pull request #6523 for details)....
Read more >Changelog — pytest-benchmark 4.0.0 documentation
PerformanceRegression exception no longer inherits pytest.UsageError (apparently a final class). 3.2.3 (2020-01-10)¶. Fixed “ ...
Read more >Apache Airflow testing with Pytest
For more details, please see the documentation ... and also ensures that tests can't affect anything in the default directory, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We plan to release it on Monday. The version would start with 2020.1 Glad you got it working. Having non existing paths seemed to be the problem + using conda run seems to give rise to this issue. Previous version of the extension was not using conda run, so you didn’t face the issue. Closing this now.
so the problem is with conda or the extension… It’s the first time I’ve had any problem regarding not existing folders on the path. Regardless of who’s the blame, there is no point continuing this, if I have other problems when the extension is updated I’ll open a new issue.