Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analysis of test coverage based on pytest marks,marks arguments as well as custom specific marks/decorators #2101

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

grusev
Copy link
Collaborator

@grusev grusev commented Jan 3, 2025

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:

pytest -s -v -m "slow and mymark" python/tests/analysis/tests_analysis.py

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

Later from command line execute:

 [project/python]> pytest --testlist=[file_path] [--force]

Any other comments?

Checklist

Checklist for code changes...
  • Have you updated the relevant docstrings, documentation and copyright notice?
  • Is this contribution tested against all ArcticDB's features?
  • Do all exceptions introduced raise appropriate error messages?
  • Are API changes highlighted in the PR description?
  • Is the PR labelled as enhancement or bug so it appears in autogenerated release notes?

@maxim-morozov maxim-morozov self-requested a review January 6, 2025 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant