From 0d47a3352ae7172b590896c3199cc045e286bac5 Mon Sep 17 00:00:00 2001 From: Trisha De Vera Date: Wed, 4 Dec 2024 13:03:43 +0800 Subject: [PATCH] Update pytest hook in conftest.py This change removes the property with docstring and adds new properties in pytest report Signed-off-by: Trisha De Vera --- test/conftest.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/test/conftest.py b/test/conftest.py index 06048fd6d..3a3f2f442 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -58,11 +58,19 @@ def pytest_runtest_makereport(item, call): generator = fixture_func(request_fixture) # Get the yielded function (test function) yielded_function = next(generator) - # Get docstring of the yielded function (test function) - yielded_docstring = yielded_function.__doc__ or "N/A" - # Add the docstring of the yielded function (test function) as property in pytest xml report + # Get the yielded function name + yielded_function_name = ( + yielded_function.__name__ or "N/A" + ) + # Get the test function module + yielded_module = yielded_function.__module__ or "N/A" + + # Add test function name and module as property in pytest xml report + item.user_properties.append( + ("test_name_function", yielded_function_name) + ) item.user_properties.append( - ("test_description", yielded_docstring) + ("test_function_module", yielded_module) )