Skip to content

Hook for passing assertions #3457

@Sup3rGeo

Description

@Sup3rGeo

Hi,

I am writing some reporting plugin for pytest and I find important that it mentions the assertions on the test, basically saying that it passed and the values involved in the comparison.

Because assert is a statement, we cannot override it or monkey patch to make it run custom reporting code. I also don't want to resort to unittest-style assertion functions as the purpose of pytest after all is making as much boilerplate free as possible.

So I was wondering if pytest has/could have some sort of hook that would be called whenever we have a passing assertion on the test, with the same assertion introspection information as showed when an assertion fails. I suppose this would have do be done around the assertion rewriting.

Can it be done right now with current features and, if not, could you give some directions on where to look for? If my abilities are enough for this I would be willing code it and make a PR if you think it is a worthy feature and everything goes fine.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: proposalproposal for a new feature, often to gather opinions or design the API around the new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions