]> granicus.if.org Git - python/commitdiff
Move the functionality for catching warnings in test_warnings.py into a separate
authorWalter Dörwald <walter@livinglogic.de>
Tue, 3 Apr 2007 16:08:10 +0000 (16:08 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Tue, 3 Apr 2007 16:08:10 +0000 (16:08 +0000)
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.

Lib/test/test_structmembers.py
Lib/test/test_warnings.py

index 93dd2acaf40664b24c2d9a50efa5c6b934111630..5dc21759b88c662db20dbeb662e0f0197aa60404 100644 (file)
@@ -39,7 +39,7 @@ class ReadWriteTests(unittest.TestCase):
         ts.T_ULONG=ULONG_MAX
         self.assertEquals(ts.T_ULONG, ULONG_MAX)
 
-class TestWarnings(test.test_warnings.TestModule):
+class TestWarnings(test.test_warnings.CatchWarningTest):
     def has_warned(self):
         self.assertEqual(test.test_warnings.msg.category,
                          exceptions.RuntimeWarning.__name__)
index a7ccb6b292d210345e63f65e2a2705d377dcf1f3..0ad83edb19bf151e11827635fc063cb94e96f234 100644 (file)
@@ -20,7 +20,7 @@ def showwarning(message, category, filename, lineno, file=None):
     msg.filename = os.path.basename(filename)
     msg.lineno = lineno
 
-class TestModule(unittest.TestCase):
+class CatchWarningTest(unittest.TestCase):
 
     def setUp(self):
         global msg
@@ -35,6 +35,8 @@ class TestModule(unittest.TestCase):
         warnings.filters = self._filters[:]
         warnings.showwarning = self._showwarning
 
+class TestModule(CatchWarningTest):
+
     def test_warn_default_category(self):
         for i in range(4):
             text = 'multi %d' %i    # Different text on each call