summaryrefslogtreecommitdiff
path: root/test/test_process.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2010-02-20 07:07:19 -0500
committerNed Batchelder <ned@nedbatchelder.com>2010-02-20 07:07:19 -0500
commit18b0df82b8055a270b007d47bade0db64d5d822d (patch)
treeb660d5348df3c1a830baf41d2b1518d0724adcec /test/test_process.py
parent86f65fd21d59fdd4febdab308e907976ca1dce6d (diff)
downloadpython-coveragepy-git-18b0df82b8055a270b007d47bade0db64d5d822d.tar.gz
A better way to test for correct handling of tracebacks during product code execution.
Diffstat (limited to 'test/test_process.py')
-rw-r--r--test/test_process.py23
1 files changed, 9 insertions, 14 deletions
diff --git a/test/test_process.py b/test/test_process.py
index b8ccb942..fcc50200 100644
--- a/test/test_process.py
+++ b/test/test_process.py
@@ -160,18 +160,13 @@ class ProcessTest(CoverageTest):
f2()
""")
+ # The important thing is for "coverage run" and "python" to report the
+ # same traceback.
out = self.run_command("coverage run throw.py")
- # Different versions of Python report the module-level code differently
- # in tracebacks, so canononicalize it.
- out = out.replace(", in ?", ", in <module>")
- expected = textwrap.dedent("""\
- Traceback (most recent call last):
- File "throw.py", line 7, in <module>
- f2()
- File "throw.py", line 5, in f2
- f1()
- File "throw.py", line 2, in f1
- raise Exception("hey!")
- Exception: hey!
- """)
- self.assertMultiLineEqual(out, expected)
+ out2 = self.run_command("python throw.py")
+ self.assertMultiLineEqual(out, out2)
+
+ # But also make sure that the output is what we expect.
+ self.assertTrue('File "throw.py", line 5, in f2' in out)
+ self.assertTrue('raise Exception("hey!")' in out)
+ self.assertFalse('coverage' in out)