diff options
-rw-r--r-- | Lib/test/test_cgi.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py index d745199..c42db4e 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): |