diff options
author | Brett Cannon <bcannon@gmail.com> | 2011-02-22 03:04:06 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2011-02-22 03:04:06 (GMT) |
commit | 7a54073a566080f3d7c10871f6ce244c9fc1221b (patch) | |
tree | c477930f8c868d6bdf9b8e65e7293bc2fdfe21ae /Lib/test/test_gc.py | |
parent | eb70e47d85d52e0bafc6b6350b9b627e0b577e96 (diff) | |
download | cpython-7a54073a566080f3d7c10871f6ce244c9fc1221b.zip cpython-7a54073a566080f3d7c10871f6ce244c9fc1221b.tar.gz cpython-7a54073a566080f3d7c10871f6ce244c9fc1221b.tar.bz2 |
Issue #10992: make tests pass when run under coverage.
Various tests fail when run under coverage. A primary culprit is refcount tests
which fail as the counts are thrown off by the coverage code. A new decorator
-- test.support.refcount_test -- is used to decorate tests which test refcounts
and to skip them when running under coverage. Other tests simply fail because
of changes in the system (e.g., __local__ suddenly appearing).
Thanks to Kristian Vlaardingerbroek for helping to diagnose the test failures.
Diffstat (limited to 'Lib/test/test_gc.py')
-rw-r--r-- | Lib/test/test_gc.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py index 0e5a397..f60d5d9 100644 --- a/Lib/test/test_gc.py +++ b/Lib/test/test_gc.py @@ -1,5 +1,6 @@ import unittest -from test.support import verbose, run_unittest, strip_python_stderr +from test.support import (verbose, refcount_test, run_unittest, + strip_python_stderr) import sys import gc import weakref @@ -175,6 +176,7 @@ class GCTests(unittest.TestCase): del d self.assertEqual(gc.collect(), 2) + @refcount_test def test_frame(self): def f(): frame = sys._getframe() @@ -242,6 +244,7 @@ class GCTests(unittest.TestCase): # For example: # - disposed tuples are not freed, but reused # - the call to assertEqual somehow avoids building its args tuple + @refcount_test def test_get_count(self): # Avoid future allocation of method object assertEqual = self._baseAssertEqual @@ -252,6 +255,7 @@ class GCTests(unittest.TestCase): # the dict, and the tuple returned by get_count() assertEqual(gc.get_count(), (2, 0, 0)) + @refcount_test def test_collect_generations(self): # Avoid future allocation of method object assertEqual = self.assertEqual |