Environment data
- VS Code version: 1.59.1
- Extension version (available under the Extensions sidebar): v2021.9.1246542782
- OS and version: Linux x64 3.10.0-1160.41.1.el7.x86_64
- Python version (& distribution if applicable, e.g. Anaconda): 3.9.0 (conda-forge)
- Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
- Relevant/affected Python packages and their versions: Pytest 6.2.5
- Relevant/affected Python-related VS Code extensions and their versions: N/A
- Value of the
python.languageServer setting: Pylance
[NOTE: If you suspect that your issue is related to the Microsoft Python Language Server (python.languageServer: 'Microsoft'), please download our new language server Pylance from the VS Code marketplace to see if that fixes your issue]
Expected behaviour
Clicking the "run all tests" button in the testing sidebar (a.k.a. test explorer) should run pytest without specifying a path, respecting the testpaths setting from pytest.ini.
From looking at backups of previous Python logs before the recent update to the extension, this is what would get called
> python -m pytest --rootdir ~/myproject
(I've removed extraneous absolute paths and options)
Actual behaviour
It passes the root dir path to pytest. In the Python log:
> python -m pytest --rootdir ~/myproject ~/myproject
This is a problem because I can't run the tests successfully like this. I get ModuleNotFoundErrors as it tries to collect stuff it doesn't need.
Steps to reproduce:
- Have a Python project with
testpaths set in pytest.ini
- Click the "run all tests" button
Logs
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
> ~/miniconda3/envs/<env-name>/bin/python -m pytest --rootdir <$HOME>/myproject --override-ini junit_family=xunit1 --junit-xml=/var/tmp/tmp-<rnd>.xml "-n 4" --disable-warnings -vv <$HOME>/myproject
Environment data
python.languageServersetting: Pylance[NOTE: If you suspect that your issue is related to the Microsoft Python Language Server (
python.languageServer: 'Microsoft'), please download our new language server Pylance from the VS Code marketplace to see if that fixes your issue]Expected behaviour
Clicking the "run all tests" button in the testing sidebar (a.k.a. test explorer) should run pytest without specifying a path, respecting the
testpathssetting frompytest.ini.From looking at backups of previous Python logs before the recent update to the extension, this is what would get called
(I've removed extraneous absolute paths and options)
Actual behaviour
It passes the root dir path to pytest. In the Python log:
This is a problem because I can't run the tests successfully like this. I get
ModuleNotFoundErrors as it tries to collect stuff it doesn't need.Steps to reproduce:
testpathsset inpytest.iniLogs
Output for
Pythonin theOutputpanel (View→Output, change the drop-down the upper-right of theOutputpanel toPython)