[TIP] Coverage threading bug?
Michael McNeil Forbes
michael.forbes+python at gmail.com
Thu Apr 23 14:47:31 PDT 2015
When I try to cover the following program, it ends up hanging and the thread is never executed (hence the even is never set). Any suggestions?
"""Bug with coverage - try running with
coverage run -m threading_bug.py
or
nosetests --with-coverage --cover-package=threading_bug threading_bug.py
"""
import threading
initialised = threading.Event()
initialised.clear()
def run():
initialised.set()
t = threading.Thread(target=run)
t.daemon = True
t.start()
while not initialised.is_set():
pass
t.join()
----------------
Let me know if I should submit this as a bug.
I found this covering code that did the following:
import pyfftw
pyfftw.interfaces.cache.enable()
More information about the testing-in-python
mailing list