mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-19 16:15:07 +00:00
In CI test always executed with option --repeat=3 that leads to generate 3 test results with the same name. Junit plugin in CI cannot distinguish correctly the difference between these results. In case when we have two passes and one fail, the link to test result will sometimes be redirected to the incorrect one because the test name is the same. To fix this ReportPlugin added that will be responsible to modify the test case name during junit report generation adding to the test name mode and run id. Fixes: https://github.com/scylladb/scylladb/issues/17851 Fixes: https://github.com/scylladb/scylladb/issues/15973
16 lines
476 B
Python
16 lines
476 B
Python
import pytest
|
|
|
|
|
|
class ReportPlugin:
|
|
# Pytest hook to modify test name to include mode and run_id
|
|
def pytest_configure(self, config):
|
|
self.config = config
|
|
self.mode = config.getoption("mode")
|
|
self.run_id = config.getoption("run_id")
|
|
|
|
@pytest.hookimpl(hookwrapper=True)
|
|
def pytest_runtest_makereport(self):
|
|
outcome = yield
|
|
report = outcome.get_result()
|
|
report.nodeid = f"{report.nodeid}.{self.mode}.{self.run_id}"
|