Analysis of test coverage based on pytest marks,marks arguments as well as custom specific marks/decorators #2101
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reference Issues/PRs
What does this implement or fix?
This is a first draft of a logic to automatically filter tests based on specific conditions - metainformation added to each test to help later different searches and coverage excercises.
There is already an implementation of very rich HTML report https://allurereport.org/docs/ along with ideas how to add metainformation in python tests
pytest has already builtin mechanism to use custom marks. Those custom marks can have arguments with named parameters or not. However, there is no builtin mechanism in pytest to run any other tests than those based on names of marks.
To observe how it works execute from command line:
The tests_analysis.py provides also a way to load all tests and mechanism how to filter them based on many criteria. This could be useful in order to get knowledge on tests. In a way this defines a way to query our tests and select only tests that we need or find if we have or not certain tests. (see, the examples at the bottom of the file)
If we need to do more advvanced criteria based on on marks and their arguments we would need to implement additional logic, like here:
https://stackoverflow.com/questions/67200501/how-can-i-run-only-tests-with-specific-marker-attribute-in-pytest
Added new plugin:
This plugin gives ability pytest to run tests based on list stored in configuration file. List
should contain names of tests like:
tests/integration/../test_module::test_a
tests/integration/../test_module::test_b
Any other comments?
Checklist
Checklist for code changes...