You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
python.testing.pytestArgs ignores multiple instances of the same arg #22999
This is a new issue that began appearing as of v2024.2
Expected:
pytestArgs which allow multiple of the same arg (e.g. --ignore=path/to/ignored/dir) pass all instances of the arg in the list to pytest
Actual:
Only the last instance of multiple args in the list are passed to pytest
Steps to reproduce:
Modify the python.testing.pytestArgs setting with multiple --ignore=path options
collect tests
Only the last ignored path in python.testing.pytestArgs will be ignored
Diagnostic data
Python version (& distribution if applicable, e.g. Anaconda): 3.12.1
Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Unknown
Value of the python.languageServer setting: Default
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
Actual command: sent:
2024-02-29 12:03:43.223 [info] > ./shared/lib_ext/python/python.exe -m pytest -p vscode_pytest --collect-only . --ignore=./__temp__/ --basetemp=./__temp__
2024-02-29 12:03:43.224 [info] cwd: .
2024-02-29 12:03:43.868 [info] Discover tests for workspace name: pmu - uri: c:\Users\dscott2\source\pmu
2024-02-29 12:03:43.868 [info] Running discovery for pytest using the new test adapter.
Hello! The fix for this has been merged and is out on the most recent release of vscode insiders. Is someone able to verify that the bug is fixed for them? If so, we can then put a point release out for stable with the fix. Thanks
Eleanor Boyd (@eleanorjboyd)
I can confirm that it fixes the issue with --ignore=path/ that I was seeing previously on 2024.3.10651007
Can't speak to the other issues mentioned above
Activity
drothlis commentedon Feb 29, 2024
I think this was introduced by #22885 here:
75ed73e#diff-19ce457a2aaf03c9ce746ac804e645758ead9dccd86e7fdd4a3367116be9b769L69-R114
drothlis commentedon Feb 29, 2024
It's worse than "ignored" — this causes an error for me. We use a custom pytest plugin which we enable with these VSCode settings:
and since 2024.2.0 this causes my pytest collection to fail with "ERROR: file or directory not found: no:python".
This is the command line VS Code is using:
Note that it's missing the second "-p".
Work around test discovery bug in VS Code v2024.2.0
pyropenguin commentedon Feb 29, 2024
I'm seeing this issue when ignoring multiple directories. Only the last ignore is used:
settings.json:
Python Output
2024-02-29 09:37:39.408 [info] > /bin/python3 -m pytest -p vscode_pytest --collect-only --ignore=src/application3/test ./srceleanorjboyd commentedon Mar 1, 2024
thank you for the bug report- yes I think you are right with the commit id that introduces this. I will work on a fix- thanks
PierreKiwi commentedon Mar 4, 2024
Hello,
Not sure if it is related, but I have the following setup:
./libs/libA
./libs/libB
When discovering the tests, I want to ignore libA tests so I added
--ignore=libs/libA, but now nothing is discovered.When running the command in the terminal, it does work just fine.
......run_adapter.py discover pytest -- -s --cache-clear --ignore=libs/libA --root-dir .fixes bug which stops duplicate pytest args (#23024)
eleanorjboyd commentedon Mar 5, 2024
Hello! The fix for this has been merged and is out on the most recent release of vscode insiders. Is someone able to verify that the bug is fixed for them? If so, we can then put a point release out for stable with the fix. Thanks
Anthony Kim (@anthonykim1) for visibility
drothlis commentedon Mar 5, 2024
Eleanor Boyd (@eleanorjboyd) does that include the code-insiders snap for linux?
I also installed the pre-release version of the Python extension:
v2024.3.10651007 (pre-release)With these versions I still get the same symptoms reported in my comment above.
drothlis commentedon Mar 5, 2024
From code inspection it seems to me that #23024 fixes this case:
...but it doesn't handle these cases (bug introduced in #22885 / #22076):
DScott-2 commentedon Mar 6, 2024
Eleanor Boyd (@eleanorjboyd)
I can confirm that it fixes the issue with --ignore=path/ that I was seeing previously on 2024.3.10651007
Can't speak to the other issues mentioned above
revert symlink changes which switched to using argMap for testing args (
fixes bug which stops duplicate pytest args (microsoft/vscode-python#…
revert symlink changes which switched to using argMap for testing args (
fixes bug which stops duplicate pytest args (microsoft/vscode-python#…
revert symlink changes which switched to using argMap for testing args (