vendredi 15 juin 2018

Tearing down any open Threads after completing all Python Unittests

this thread discusses at great length why it is not a good idea to kill threads. And I agree when we are talking about an actual program. I am writing unit tests for several components as well as some integration tests between them. Some require threading. When tests fail, some threads stay open, locked in a .get() call of a queue. This causes the whole test suite to get stuck and not complete. I am running either ptw (pytest watch) or a custom loop of pytest with inotifywait to watch for changes in my files to rerun the suite.

When all tests have completed, I want the suite to kill any remaining threads to complete the loop and not be stuck on a thread somewhere that is just open because of a test failure. Is this possible?

Aucun commentaire:

Enregistrer un commentaire