Issue #21925: Fix test_warnings for release mode

Use -Wd comment line option to log the ResourceWarning.
This commit is contained in:
Victor Stinner 2016-03-25 09:51:14 +01:00
parent 244e12088d
commit 540a81c720
1 changed files with 2 additions and 2 deletions

View File

@ -962,12 +962,12 @@ a=A()
# don't import the warnings module
# (_warnings will try to import it)
code = "f = open(%a)" % __file__
rc, out, err = assert_python_ok("-c", code)
rc, out, err = assert_python_ok("-Wd", "-c", code)
self.assertTrue(err.startswith(expected), ascii(err))
# import the warnings module
code = "import warnings; f = open(%a)" % __file__
rc, out, err = assert_python_ok("-c", code)
rc, out, err = assert_python_ok("-Wd", "-c", code)
self.assertTrue(err.startswith(expected), ascii(err))