Reputation: 509
I run my tests:
manage.py test myapp
and at the end I get:
Ran 22 tests in 7.243s
OK
Exception in thread Thread-22 (most likely raised during interpreter shutdown)
or
Ran 22 tests in 7.243s
OK
Unhandled exception in thread started by < function observe at ... > ...
or simple
Ran 22 tests in 7.243s
OK
Function observe() is not called during testing (it is a separate thread), but I am getting above exceptions...
What should I do in order to tests omitted this function?
Upvotes: 0
Views: 320
Reputation: 59516
Wrapping the run()
method of the threads into try
/except
can help:
import traceback
class MyThread(Thread):
def run(self):
try:
oldRun(self)
except:
traceback.print_exc()
def oldRun(self):
# insert here the code from the original run function
Upvotes: 1