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
After 385796b, pytest sends all files in the current directory to every plugin's pytest_collect_file hook, even if you are only wanting to run/collect tests from one file. If you have pytest-cpp installed, it means it executes all executable files in the current directory, which isn't desired behavior at all, or at least unexpected.
safety/
test_toyota.py
test_coverage.sh # shouldn't be run
pytest test_toyota.py -> runs test_coverage.sh (which in my case is long running and runs another pytest causing a recursive loop)
Now, this isn't because of pytest per se, but the pytest-cpp plugin which runs all executable files with --help to discover if it's a certain test suite file. If this new behavior of collecting every file, despite specifying your file filter is intentional, we can close this.
A worse case is just:
safety/
test_toyota.py
test.sh
where test.sh has a pytest command inside it with some extra setup:
pytest -n auto test_*.py -k 'not Base'
currently, it will recursively run itself with pytest-cpp installed.
The text was updated successfully, but these errors were encountered:
sshane
changed the title
pytest now runs all executable files in directory of test file
pytest now collects all files in current directory even if you specify test files
Feb 14, 2024
sshane
changed the title
pytest now collects all files in current directory even if you specify test files
pytest 8.0.0 now collects all files in current directory even if you specify test files
Feb 14, 2024
After 385796b, pytest sends all files in the current directory to every plugin's
pytest_collect_file
hook, even if you are only wanting to run/collect tests from one file. If you have pytest-cpp installed, it means it executes all executable files in the current directory, which isn't desired behavior at all, or at least unexpected.pytest test_toyota.py
-> runs test_coverage.sh (which in my case is long running and runs another pytest causing a recursive loop)Now, this isn't because of pytest per se, but the pytest-cpp plugin which runs all executable files with
--help
to discover if it's a certain test suite file. If this new behavior of collecting every file, despite specifying your file filter is intentional, we can close this.A worse case is just:
where test.sh has a pytest command inside it with some extra setup:
currently, it will recursively run itself with
pytest-cpp
installed.The text was updated successfully, but these errors were encountered: