Oliver
Oliver

Reputation: 29591

Python Nose unit testing using separate (sequential) Python processes

We use Python Nose for unit testing our GUI app components and application logic. Nose runs all tests in one process, not a big problem for the application logic but for a complex C++/Python lib like PyQt, this is a problem since there is "application wide" state that Qt creates, and it is hard to ensure that cleanup occurs at the right time such that every test method has a "clean Qt slate".

So I would prefer to have Nose start a separate Python process for each test method/function (or at least those that are flagged as needed this). I realize this would slow down the test suite but the benefit should outweigh the cost. I have seen the Insulate and the Multiprocess plugins but neither do this (Insulate only starts separate proc if a crash occurs -- Multiprocess just tries to use N process for N cores).

Any suggestions?

Upvotes: 1

Views: 956

Answers (1)

Oleksiy
Oleksiy

Reputation: 6567

You can try nosetests --processes=1 --process-restartworker

Upvotes: 2

Related Questions