From ece4872e9012a17ea9f48878582a48542e1ddc21 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 17 Jan 2017 10:54:04 -0500 Subject: A better way to deal with 2.6 missing SkipTest --- coverage/misc.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'coverage/misc.py') diff --git a/coverage/misc.py b/coverage/misc.py index c5f8f20e..b3b439c4 100644 --- a/coverage/misc.py +++ b/coverage/misc.py @@ -284,7 +284,11 @@ class ExceptionDuringRun(CoverageException): pass -class StopEverything(unittest.SkipTest if env.TESTING else object): +# unittest.SkipTest doesn't exist in Python 2.6. We backport it with +# unittest2 in the coverage.py test suite. But for production, we don't need +# to derive from SkipTest, so if it doesn't exist, just use object. + +class StopEverything(getattr(unittest, 'SkipTest', object)): """An exception that means everything should stop. This derives from SkipTest so that tests that spring this trap will be -- cgit v1.2.1