From 7a54073a566080f3d7c10871f6ce244c9fc1221b Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Tue, 22 Feb 2011 03:04:06 +0000 Subject: 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. --- Lib/test/test_metaclass.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Lib/test/test_metaclass.py') diff --git a/Lib/test/test_metaclass.py b/Lib/test/test_metaclass.py index 219ab99840..6862900b01 100644 --- a/Lib/test/test_metaclass.py +++ b/Lib/test/test_metaclass.py @@ -246,7 +246,13 @@ Test failures in looking up the __prepare__ method work. """ -__test__ = {'doctests' : doctests} +import sys + +# Trace function introduces __locals__ which causes various tests to fail. +if hasattr(sys, 'gettrace') and sys.gettrace(): + __test__ = {} +else: + __test__ = {'doctests' : doctests} def test_main(verbose=False): from test import support -- cgit v1.2.1