jeudi 7 janvier 2021

pytest - How to execute a function after specific tests

I have some tests organized in several classes. I already have a test fixture with scope=class so that it would run before suite(class) of tests. However, I need to execute a function after some specific tests. Lets say I have 100 tests in a class, I already have a fixture that will execute a function before these tests, but I also want to run a function after 2-3 of these tests.

What is the best approach to achieve that? Can it be done with fixtures or anything else ?

Aucun commentaire:

Enregistrer un commentaire