From: Phillip J. Eby Date: Mon, 10 Apr 2006 18:33:17 +0000 (+0000) Subject: test_contextlib wasn't actually being run by regrtest.py. Or more precisely, X-Git-Tag: v2.5a2~368 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bd0c10f7c99db3272b5db2b1f21ed43b96d260c0;p=python test_contextlib wasn't actually being run by regrtest.py. Or more precisely, it was being run, but no tests were actually executed! --- diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py index cd8895e873..7d601fab46 100644 --- a/Lib/test/test_contextlib.py +++ b/Lib/test/test_contextlib.py @@ -2,12 +2,14 @@ from __future__ import with_statement +import sys import os import decimal import tempfile import unittest import threading from contextlib import * # Tests __all__ +from test.test_support import run_suite class ContextManagerTestCase(unittest.TestCase): @@ -327,5 +329,11 @@ class DecimalContextTestCase(unittest.TestCase): self.fail("Didn't raise ZeroDivisionError") +# This is needed to make the test actually run under regrtest.py! +def test_main(): + run_suite( + unittest.defaultTestLoader.loadTestsFromModule(sys.modules[__name__]) + ) + if __name__ == "__main__": - unittest.main() + test_main()