diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2011-03-20 13:34:28 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2011-03-20 13:34:28 (GMT) |
commit | 45763d0d12c22fdfc61ea130af5757bc71a96519 (patch) | |
tree | 6987e6b5ab2c0868bd250a6e2a792aa0625b3d3a /Lib | |
parent | cc9564ecd8cea04e20bd0fac235117cfbb660d6b (diff) | |
parent | 60c3c9f91820ee90c9ebc15addae15bbef17bd9b (diff) | |
download | cpython-45763d0d12c22fdfc61ea130af5757bc71a96519.zip cpython-45763d0d12c22fdfc61ea130af5757bc71a96519.tar.gz cpython-45763d0d12c22fdfc61ea130af5757bc71a96519.tar.bz2 |
Merge with 3.2.
Diffstat (limited to 'Lib')
-rwxr-xr-x | Lib/test/regrtest.py | 9 | ||||
-rw-r--r-- | Lib/unittest/test/test_program.py | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 6267702..a7a7de3 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -827,7 +827,8 @@ class saved_test_environment: resources = ('sys.argv', 'cwd', 'sys.stdin', 'sys.stdout', 'sys.stderr', 'os.environ', 'sys.path', 'sys.path_hooks', '__import__', 'warnings.filters', 'asyncore.socket_map', - 'logging._handlers', 'logging._handlerList', 'sys.gettrace') + 'logging._handlers', 'logging._handlerList', 'sys.gettrace', + 'sys.warnoptions') def get_sys_argv(self): return id(sys.argv), sys.argv, sys.argv[:] @@ -914,6 +915,12 @@ class saved_test_environment: # Can't easily revert the logging state pass + def get_sys_warnoptions(self): + return id(sys.warnoptions), sys.warnoptions, sys.warnoptions[:] + def restore_sys_warnoptions(self, saved_options): + sys.warnoptions = saved_options[1] + sys.warnoptions[:] = saved_options[2] + def resource_info(self): for name in self.resources: method_suffix = name.replace('.', '_') diff --git a/Lib/unittest/test/test_program.py b/Lib/unittest/test/test_program.py index a50a245..d5d0f5a 100644 --- a/Lib/unittest/test/test_program.py +++ b/Lib/unittest/test/test_program.py @@ -189,7 +189,7 @@ class TestCommandLineArgs(unittest.TestCase): class FakeTP(unittest.TestProgram): def parseArgs(self, *args, **kw): pass def runTests(self, *args, **kw): pass - warnoptions = sys.warnoptions + warnoptions = sys.warnoptions[:] try: sys.warnoptions[:] = [] # no warn options, no arg -> default |