0

I am new to pytest and I am trying to understand fixtures. I want to print the result of my testcase (pass or fail) in teardown of the fixture. The fixture should be use the auto use feature .

Upon running the testcase if the testcase has failed.

The print statement should say pass or fail if the test cases has failed

Can someone help me with this?

juniper27
  • 1
  • 1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Oct 31 '22 at 05:10

1 Answers1

0

I agree with Community's comment but, if all you want is to access the results of the tests in the teardown part of the fixture, it is documented: https://docs.pytest.org/en/latest/example/simple.html#making-test-result-information-available-in-fixtures

(Also, your question may be a duplicate of How to use test result in "teardown" in fixtures in "pytest" framework )

bortzmeyer
  • 34,164
  • 12
  • 67
  • 91
  • I refered to the link but I find hard to understand how get_result and hook implementation works is there a way you can simplify and explain the example. Thanks in advance – juniper27 Nov 06 '22 at 22:27