summaryrefslogtreecommitdiff
path: root/test/test_oddball.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2010-08-26 08:12:29 -0400
committerNed Batchelder <ned@nedbatchelder.com>2010-08-26 08:12:29 -0400
commitaa75e73d926b6350da8336a46809a4406e187edd (patch)
tree0943aab07a762bc004dc8998af48c603daf55bbc /test/test_oddball.py
parent7c14b919bae2ea0e4c72e5bb4116626f3a9b6230 (diff)
downloadpython-coveragepy-aa75e73d926b6350da8336a46809a4406e187edd.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.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/test_oddball.py b/test/test_oddball.py
index f5d21aa..3d5bf09 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."""