diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2010-08-26 08:12:29 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2010-08-26 08:12:29 -0400 |
commit | a7881d330129a3f80ba5f4bffc9c069020e22731 (patch) | |
tree | 8448b8d4eb9a36f7f92fc037cfc95c06e35f43a2 /test/test_oddball.py | |
parent | 9726ca6bbdc7d1ed5b0f732071210eed4ceada34 (diff) | |
download | python-coveragepy-git-a7881d330129a3f80ba5f4bffc9c069020e22731.tar.gz |
The thread-startup dance caused Thread.run() to not be measured. This fixes it, I hope without introducing too much more new code. Fixes #85.
Diffstat (limited to 'test/test_oddball.py')
-rw-r--r-- | test/test_oddball.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/test/test_oddball.py b/test/test_oddball.py index f5d21aa9..3d5bf097 100644 --- a/test/test_oddball.py +++ b/test/test_oddball.py @@ -12,7 +12,7 @@ class ThreadingTest(CoverageTest): def test_threading(self): self.check_coverage("""\ - import time, threading + import threading def fromMainThread(): return "called from main thread" @@ -30,6 +30,25 @@ class ThreadingTest(CoverageTest): """, [1,3,4,6,7,9,10,12,13,14,15], "10") + def test_thread_run(self): + self.check_coverage("""\ + import threading + + class TestThread(threading.Thread): + def run(self): + self.a = 5 + self.do_work() + self.a = 7 + + def do_work(self): + self.a = 10 + + thd = TestThread() + thd.start() + thd.join() + """, + [1,3,4,5,6,7,9,10,12,13,14], "") + class RecursionTest(CoverageTest): """Check what happens when recursive code gets near limits.""" |