summaryrefslogtreecommitdiff
path: root/test/test_oddball.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2011-04-25 21:29:20 -0400
committerNed Batchelder <ned@nedbatchelder.com>2011-04-25 21:29:20 -0400
commit71d861179873e6eef995fce2d7bb13dd1da14edf (patch)
tree6842f19fe2bdac124f7378e5277e9c3737ab9c63 /test/test_oddball.py
parenta64cdfd45a453782d4277523bdafd72bbdb44143 (diff)
downloadpython-coveragepy-71d861179873e6eef995fce2d7bb13dd1da14edf.tar.gz
A fix for bug #123, but it doesn't restore tracing properly yet, still want to get to the bottom of that.
Diffstat (limited to 'test/test_oddball.py')
-rw-r--r--test/test_oddball.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/test_oddball.py b/test/test_oddball.py
index e94e2ba..9b65a98 100644
--- a/test/test_oddball.py
+++ b/test/test_oddball.py
@@ -348,3 +348,20 @@ if sys.version_info >= (2, 5):
doctest.testmod(sys.modules[__name__]) # we're not __main__ :(
''',
[1,11,12,14,16,17], "")
+
+
+if hasattr(sys, 'gettrace'):
+ class GettraceTest(CoverageTest):
+ """Tests that we work properly with `sys.gettrace()`."""
+ def test_round_trip(self):
+ self.check_coverage('''\
+ import sys
+ def foo(n):
+ return 3*n
+ def bar(n):
+ return 5*n
+ a = foo(6)
+ sys.settrace(sys.gettrace())
+ a = bar(8)
+ ''',
+ [1,2,3,4,5,6,7,8], "")