Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize the matching rule of conditional marks (#14395)
What is the motivation for this PR? Previously, the matching rule of the conditional marks was based on the longest match. This meant that when a test case had multiple potential matches, we only applied the mark with the longest matching entry. In this PR, we've optimized this rule: we now consider all potential matches. If a mark is unique across these matches, it will be applied to the test case. Otherwise, we will still use the longest matching entry. How did you do it? In this PR, we've optimized this rule of conditional mark: we now consider all potential matches. If a mark is unique across these matches, it will be applied to the test case. Otherwise, we will still use the longest matching entry. How did you verify/test it? We have conditional marks below mark: skip: reason: "Skip mark" conditions: - "topo_type in ['vs']" mark/test_mark.py: xfail: reason: "Xfail mark/test_mark.py" conditions: - "asic_type in ['vs']" skip: reason: "Skip mark/test_mark.py" conditions: - "asic_type in ['vs']" mark/test_mark.py::test_conditional_mark: skip: reason: "Skip mark/test_mark.py::test_conditional_mark" conditions: - "asic_type in ['vs']" And we run test case mark/test_mark.py::test_conditional_mark on kvm testbed. We get the expected match of this test case and add them to the case 08:25:40 __init__.pytest_collection_modifyitems L0611 INFO | Found match "[{'mark/test_mark.py::test_conditional_mark': {'skip': {'reason': 'Skip mark/test_mark.py::test_conditional_mark', 'conditions': ["asic_type in ['vs']"]}}}, {'mark/test_mark.py': {'xfail': {'reason': 'Xfail mark/test_mark.py', 'conditions': ["asic_type in ['vs']"]}}}]" for test case "mark/test_mark.py::test_conditional_mark" 08:25:40 __init__.pytest_collection_modifyitems L0649 INFO | Adding mark MarkDecorator(mark=Mark(name='skip', args=(), kwargs={'reason': 'Skip mark/test_mark.py::test_conditional_mark'})) to mark/test_mark.py::test_conditional_mark 08:25:40 __init__.pytest_collection_modifyitems L0649 INFO | Adding mark MarkDecorator(mark=Mark(name='xfail', args=(), kwargs={'reason': 'Xfail mark/test_mark.py', 'strict': False})) to mark/test_mark.py::test_conditional_mark Any platform specific information?
- Loading branch information