Thread.run() isn't measured

Issue #85 resolved
Ned Batchelder
repo owner created an issue

In this code:

{{{
import Queue
import threading
import unittest

class TestThread(threading.Thread):
def init(self, started_queue, stopping_queue):
threading.Thread.init(self)
self._started_queue = started_queue
self._stopping_queue = stopping_queue

def run(self):
    print "starting thread"
    self.fooey()
    self._started_queue.put('')
    msg = self._stopping_queue.get()
    print "exiting thread"

def fooey(self):
    print "fooey"
    self.booey()
    print "fooey out:"

def booey(self):
    print "booey"

class ThreadTest(unittest.TestCase):
def test_threads(self):
starting_queue = Queue.Queue()
stopping_queue = Queue.Queue()
thd = TestThread(starting_queue, stopping_queue)
stopping_queue.put('')
thd.start()
starting_queue.get()
thd.join()
self.assertTrue(True)

if name == 'main':
unittest.main()
}}}

run() is marked as not covered, but fooey() and booey() are. What's up with that?

Comments (3)

  1. Log in to comment