Skip to content

Commit

Permalink
Merge pull request #617 from trishaange01/update_conftest
Browse files Browse the repository at this point in the history
  • Loading branch information
tfcollins authored Dec 6, 2024
2 parents a073555 + 0d47a33 commit 9fcac82
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)


Expand Down

0 comments on commit 9fcac82

Please sign in to comment.