MCPcopy Create free account
hub / github.com/apache/impala / TestCounterPlugin

Class TestCounterPlugin

tests/run-tests.py:77–104  ·  view source on GitHub ↗

Custom pytest plugin to count the number of tests collected and executed over multiple pytest runs tests_collected is set of nodeids for collected tests tests_executed is set of nodeids for executed tests

Source from the content-addressed store, hash-verified

75
76
77class TestCounterPlugin(object):
78 """ Custom pytest plugin to count the number of tests
79 collected and executed over multiple pytest runs
80
81 tests_collected is set of nodeids for collected tests
82 tests_executed is set of nodeids for executed tests
83 """
84 def __init__(self):
85 self.tests_collected = set()
86 self.tests_executed = set()
87
88 # pytest hook to handle test collection when xdist is used (parallel tests)
89 # https://github.com/pytest-dev/pytest-xdist/pull/35/commits
90 # (No official documentation available)
91 def pytest_xdist_node_collection_finished(self, node, ids): # noqa: U100
92 self.tests_collected.update(set(ids))
93
94 # link to pytest_collection_modifyitems
95 # https://docs.pytest.org/en/6.2.x/writing_plugins.html#hook-function-validation-and-execution
96 def pytest_collection_modifyitems(self, items):
97 for item in items:
98 self.tests_collected.add(item.nodeid)
99
100 # link to pytest_runtest_logreport
101 # https://docs.pytest.org/en/6.2.x/_modules/_pytest/hookspec.html#pytest_runtest_logreport
102 def pytest_runtest_logreport(self, report):
103 if report.passed:
104 self.tests_executed.add(report.nodeid)
105
106
107class TestExecutor(object):

Callers 1

run_testsMethod · 0.85

Calls

no outgoing calls

Tested by 1

run_testsMethod · 0.68