[Python] Pytest: run a function at the end of the tests

Discussão em 'Python' iniciado por Stack, Maio 27, 2025.

  1. Stack

    Stack Membro Participativo

    I would like to run a function at the end of all the tests.

    A kind of global teardown function.

    I found an example here and some clues here but it doesn't match my need. It runs the function at the beginning of the tests. I also saw the function pytest_runtest_teardown(), but it is called after each test.

    Plus: if the function could be called only if all the tests passed, it would be great.

    Continue reading...

Compartilhe esta Página