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
Discover tests is overriding standard testpaths after configuration with the "Configure Tests" command.
By forcing the selection of the directory, the pytest --collect-only test discovery is run with a single directory as the argument, which overrides any testpaths set in external tools, for example pyproject.toml
If the command allows skipping of the directory selection, and doesn't set the related pytestArgs setting, test discovery will run normally.
Steps to reproduce:
Configure project with pyproject.toml with [tools.pytest.ini_options] that defines testspaths = ["some","list","of/different","testpaths"]
Open in vscode with python plugin
Select "Python: Configure Tests" from action menu, or via "Testing" -> button
Select pytest
Select root directory
Discover tests takes a long time in large directory trees (e.g. .venv, libs, etc) because the configured testpaths are being overridden.
Extension version: 2024.8.1
VS Code version: Code 1.90.2 (5437499feb04f7a586f677b155b039bc2b3669eb, 2024-06-18T22:33:48.698Z)
OS version: Linux x64 6.8.0-36-generic
Modes:
Remote OS version: Linux x64 6.8.0-36-generic
Hi! If you delete all your pytest args (or more specifically the ".") does this fix the problem? Go to settings.json and look for "python.testing.pytestArgs"
Jurriaan-BlueGen understood thanks! We have the setup steps which include selecting what folder your tests are in but we should be more explicit about that answer being used to update / change the args
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.
Activity
eleanorjboyd commentedon Jun 27, 2024
Hi! If you delete all your pytest args (or more specifically the ".") does this fix the problem? Go to settings.json and look for "python.testing.pytestArgs"
Jurriaan-BlueGen commentedon Jul 1, 2024
Yes, it solves the problem, and it's what I did as a workaround.
It just took a while to figure out why the paths were being ignored, and why the discovery took so long.
eleanorjboyd commentedon Jul 1, 2024
Jurriaan-BlueGen understood thanks! We have the setup steps which include selecting what folder your tests are in but we should be more explicit about that answer being used to update / change the args
github-actions commentedon Aug 29, 2024
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.
Happy Coding!