From: Ezio Melotti Date: Thu, 14 Jul 2011 12:18:57 +0000 (+0300) Subject: Restore the global state of the log vars, so that test_cgi can be run twice without... X-Git-Tag: v3.2.2rc1~115 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7ebb7061339f242b9ffd9fd8a7ad1f172d341666;p=thirdparty%2FPython%2Fcpython.git Restore the global state of the log vars, so that test_cgi can be run twice without failures. --- diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py index d745199464ab..c42db4e70d98 100644 --- a/Lib/test/test_cgi.py +++ b/Lib/test/test_cgi.py @@ -155,7 +155,13 @@ class CgiTests(unittest.TestCase): cgi.logfp = None cgi.logfile = "/dev/null" cgi.initlog("%s", "Testing log 3") - self.addCleanup(cgi.logfp.close) + def log_cleanup(): + """Restore the global state of the log vars.""" + cgi.logfile = '' + cgi.logfp.close() + cgi.logfp = None + cgi.log = cgi.initlog + self.addCleanup(log_cleanup) cgi.log("Testing log 4") def test_fieldstorage_readline(self):