From aa35e66a372e6f8ddb54d8c648c15620e9c566ac Mon Sep 17 00:00:00 2001 From: Artem Rys Date: Mon, 5 Aug 2024 16:32:54 +0200 Subject: [PATCH] fix: trim test report (#875) This commit removes unused properties for tests which passed. This PR substitutes #873 PR. Co-authored-by: Harshil Gajera --- pytest_splunk_addon/splunk.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pytest_splunk_addon/splunk.py b/pytest_splunk_addon/splunk.py index 0bcd046d0..610f3728f 100644 --- a/pytest_splunk_addon/splunk.py +++ b/pytest_splunk_addon/splunk.py @@ -835,6 +835,16 @@ def update_recommended_fields(model, datasets, cim_version): return update_recommended_fields +@pytest.hookimpl(hookwrapper=True) +def pytest_runtest_makereport(item): + """ + Show user properties in report only in case of failure + """ + output = yield + if output.get_result().outcome == "passed": + item.user_properties = [] + + @pytest.fixture(scope="session") def docker_ip(): """Determine IP address for TCP connections to Docker containers."""