]> granicus.if.org Git - python/commitdiff
Don't call warnings.resetwarnings(); that does bad things that cause
authorFred Drake <fdrake@acm.org>
Thu, 17 Oct 2002 22:09:03 +0000 (22:09 +0000)
committerFred Drake <fdrake@acm.org>
Thu, 17 Oct 2002 22:09:03 +0000 (22:09 +0000)
other tests to generate warning when they didn't before.  In
particular, this cancels not only filters set by -W, but also from
test.regrtest.

Lib/test/test_tempfile.py

index 0f5ce9f7580f465bdd3b1af7662dd74db0190295..cb957245a191cbc7da550573cda5814554940cd4 100644 (file)
@@ -10,6 +10,10 @@ import warnings
 import unittest
 from test import test_support
 
+warnings.filterwarnings("ignore",
+                        category=RuntimeWarning,
+                        message="mktemp", module=__name__)
+
 if hasattr(os, 'stat'):
     import stat
     has_stat = 1
@@ -478,16 +482,11 @@ class test_mktemp(TC):
     # We must also suppress the RuntimeWarning it generates.
     def setUp(self):
         self.dir = tempfile.mkdtemp()
-        warnings.filterwarnings("ignore",
-                                category=RuntimeWarning,
-                                message="mktemp")
 
     def tearDown(self):
         if self.dir:
             os.rmdir(self.dir)
             self.dir = None
-        # XXX This clobbers any -W options.
-        warnings.resetwarnings()
 
     class mktemped:
         _unlink = os.unlink