It makes more sense to call resetwarnings() after every test runs than
to keep doing that in every test that wants to filter a warning.
This commit is contained in:
parent
a91a02a76d
commit
7d79948103
|
@ -55,6 +55,7 @@ import getopt
|
||||||
import traceback
|
import traceback
|
||||||
import random
|
import random
|
||||||
import StringIO
|
import StringIO
|
||||||
|
import warnings
|
||||||
|
|
||||||
import test_support
|
import test_support
|
||||||
|
|
||||||
|
@ -322,6 +323,7 @@ def runtest(test, generate, verbose, quiet, testdir = None):
|
||||||
indirect_test()
|
indirect_test()
|
||||||
finally:
|
finally:
|
||||||
sys.stdout = save_stdout
|
sys.stdout = save_stdout
|
||||||
|
warnings.resetwarnings()
|
||||||
except (ImportError, test_support.TestSkipped), msg:
|
except (ImportError, test_support.TestSkipped), msg:
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print "test", test, "skipped --", msg
|
print "test", test, "skipped --", msg
|
||||||
|
|
|
@ -158,5 +158,3 @@ check_all("weakref")
|
||||||
check_all("webbrowser")
|
check_all("webbrowser")
|
||||||
check_all("xdrlib")
|
check_all("xdrlib")
|
||||||
check_all("zipfile")
|
check_all("zipfile")
|
||||||
|
|
||||||
warnings.resetwarnings()
|
|
||||||
|
|
|
@ -113,8 +113,5 @@ def do_prefix_binops():
|
||||||
warnings.filterwarnings("ignore",
|
warnings.filterwarnings("ignore",
|
||||||
r'complex divmod\(\), // and % are deprecated',
|
r'complex divmod\(\), // and % are deprecated',
|
||||||
DeprecationWarning)
|
DeprecationWarning)
|
||||||
try:
|
do_infix_binops()
|
||||||
do_infix_binops()
|
do_prefix_binops()
|
||||||
do_prefix_binops()
|
|
||||||
finally:
|
|
||||||
warnings.resetwarnings()
|
|
||||||
|
|
|
@ -32,8 +32,6 @@ class XMLParserTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(XMLParserTestCase)
|
test_support.run_unittest(XMLParserTestCase)
|
||||||
warnings.resetwarnings()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
Loading…
Reference in New Issue