diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2009-07-12 09:20:49 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2009-07-12 09:20:49 -0400 |
commit | f8c89008f9809137edf63e756a1d0d891500b771 (patch) | |
tree | 6b266596e9170fd7ee5819923e7ea7cbf62a6e03 /test/test_coverage.py | |
parent | 4bb849f39914138316b33dec2ddb427fb5142b41 (diff) | |
download | python-coveragepy-git-f8c89008f9809137edf63e756a1d0d891500b771.tar.gz |
Narrow the amount of code in a coverage start/stop window in a test so that the differences in 2.x and 3.x scoping rules don't change the results of the test. Also, some commented-out logging of the trace machinery that helped me find the problem. Now all tests pass on Python 3.1!
Diffstat (limited to 'test/test_coverage.py')
-rw-r--r-- | test/test_coverage.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/test/test_coverage.py b/test/test_coverage.py index 7ff5b4c0..e548ab4c 100644 --- a/test/test_coverage.py +++ b/test/test_coverage.py @@ -1841,23 +1841,23 @@ class ExceptionTest(CoverageTest): # Each run nests the functions differently to get different combinations # of catching exceptions and letting them fly. runs = [ - ("fly oops", { + ("doit fly oops", { 'doit.py': [302,303,304,305], 'fly.py': [102,103], 'oops.py': [2,3], }), - ("catch oops", { + ("doit catch oops", { 'doit.py': [302,303], 'catch.py': [202,203,204,206,207], 'oops.py': [2,3], }), - ("fly catch oops", { + ("doit fly catch oops", { 'doit.py': [302,303], 'fly.py': [102,103,104], 'catch.py': [202,203,204,206,207], 'oops.py': [2,3], }), - ("catch fly oops", { + ("doit catch fly oops", { 'doit.py': [302,303], 'catch.py': [202,203,204,206,207], 'fly.py': [102,103], @@ -1866,12 +1866,15 @@ class ExceptionTest(CoverageTest): ] for callnames, lines_expected in runs: - cov = coverage.coverage() - # Import the python file, executing it. - cov.start() + # Make the list of functions we'll call for this test. calls = [getattr(sys.modules[cn], cn) for cn in callnames.split()] - getattr(sys.modules['doit'], 'doit')(calls) + + cov = coverage.coverage() + cov.start() + # Call our list of functions: invoke the first, with the rest as + # an argument. + calls[0](calls[1:]) cov.stop() # Clean the line data and compare to expected results. |