Pytest test discovery failing when pytestArgs
contains filepaths · Issue #18562 · microsoft/vscode-python (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
Issue Type: Bug
At the moment, files are filtered from pytestArgs
before test discovery is run. This is unexpected for a user and could lead to issues:
- Not all tests will be found
Given a file tree andpytestArgs
tests/
├── dir
│ └── test_b.py
├── helpers
│ └── test_c.py
└── test_a.py
"python.testing.pytestArgs": [
"tests/dir",
"tests/helpers/test_c.py",
],
tests/helpers/test_c.py
would be filtered and only tests inside of tests/dir
would be discovered.
- pytest discovery failing completely
In large projects it's possible that different test subfolders require different dependencies viaconftest.py
. Not all of them might be installed. If the desire was to only discover tests intests/dir/test_b.py
, having that argument filtered would mean that discovery is run from root and thus allconftest.py
files are loaded. If the test is inside a subfolder, it's possible to work around it by removing the filename. However that doesn't work for tests inside the root test directory.
Extension version: 2022.0.1814523869
VS Code version: Code 1.64.2 (f80445acd5a3dadef24aa209168452a3d97cc326, 2022-02-09T22:00:58.347Z)
OS version: Darwin x64 19.6.0
Restricted Mode: No