Skip to content

Adding test name to the pytest_runtest_call #9376

Answered by The-Compiler
f00dog-x300 asked this question in Q&A
Discussion options

You must be logged in to vote

request is a pytest fixture, i.e. exposed via a mechanism you can only access from tests or from other fixtures, but not from hooks (which, you could say, are more low-level in a sense).

However, the item argument of pytest_runtest_call is the test Item - and Item is a subclass of Node, which is what request.node points at (Underlying collection node (depends on current request scope).).

Long story short: item.name should get you there!

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@f00dog-x300
Comment options

@The-Compiler
Comment options

Answer selected by f00dog-x300
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants