bavaza
bavaza

Reputation: 11047

py.test hangs after showing test results

I'm using py.test to run a bunch of tests. The tests seem to pass, but the process never terminates:

===== test session starts =====

platform win32 -- Python 2.7.3 -- pytest-2.3.4

collected 179 items

common/tests/test_bar.py ...............

common/tests/test_foo.py .......

....

===== 159 passed, 20 skipped in 98.58 seconds =====

<-- the prompt never gets back -->

Any ideas what can cause this and how to debug?

EDIT

@hpk42 is right - it was a non-daemon thread that never terminated.

Upvotes: 12

Views: 6927

Answers (1)

hpk42
hpk42

Reputation: 23571

It's likely that your tests start a thread with server loops. If that is the case, you may use thread.setDaemon(True) which marks the thread as "can be thrown away" and might help to get through the Python shutdown. Ideally, though, you should rather signal to your thread/loop that it should terminate.

Upvotes: 16

Related Questions