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
I'm developing a feature that requires pytest-dependency to automatically execute all prerequisite tests when a single dependent test is run from the command line.
The ultimate goal is to analyze the complete dependency graph and ensure all required tests are added to the execution queue.
Core Problem
When I run a subset of tests, like pytest tests/api, Pytest only collects tests in that path, preventing me from analyzing the complete dependency graph needed for the feature.
I need a way to solve this in two phases:
Programmatic Full Collection: How can I programmatically collect all tests in the project (e.g., all tests under the root tests/ directory) without impacting the performance or the user-defined collection scope? I need access to the full test graph, even if the user only specified a subdirectory.
Adding Tests for Execution: Once I identify the necessary dependency tests, what is the most robust way to programmatically add these new tests to the execution list before running starts (e.g., using a Pytest hook)?
Any insight into the right Pytest hooks (pytest_collection_finish, etc.) or methods to manipulate the test collection/execution list would be highly valued!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
I'm developing a feature that requires pytest-dependency to automatically execute all prerequisite tests when a single dependent test is run from the command line.
The ultimate goal is to analyze the complete dependency graph and ensure all required tests are added to the execution queue.
Core Problem
When I run a subset of tests, like pytest tests/api, Pytest only collects tests in that path, preventing me from analyzing the complete dependency graph needed for the feature.
I need a way to solve this in two phases:
Programmatic Full Collection: How can I programmatically collect all tests in the project (e.g., all tests under the root tests/ directory) without impacting the performance or the user-defined collection scope? I need access to the full test graph, even if the user only specified a subdirectory.
Adding Tests for Execution: Once I identify the necessary dependency tests, what is the most robust way to programmatically add these new tests to the execution list before running starts (e.g., using a Pytest hook)?
Any insight into the right Pytest hooks (pytest_collection_finish, etc.) or methods to manipulate the test collection/execution list would be highly valued!
Thank you! 🙏
Beta Was this translation helpful? Give feedback.
All reactions