79237917

Date: 2024-11-29 17:36:03
Score: 1
Natty:
Report link

I am also interested into printing the count of assertions of unit-tests with pytest.

Although I do not have a working solution, this piece of documentation shows that pytest rewrites the statements assert behind the scene: https://docs.pytest.org/en/stable/how-to/assert.html#assert-details

The fact that pytest rewrites the statements assert has been there for a while, see this blog post pointed by the documentation: https://pybites.blogspot.com/2011/07/behind-scenes-of-pytests-new-assertion.html

That invalidates a comment above saying that pytest uses Python's native assert.

Though I still don't know how to have pytest print the count of asserts. Maybe with a plugin.

Reasons:
  • Blacklisted phrase (1): this blog
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Julien Ferté