diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2011-07-14 15:18:57 +0300 |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2011-07-14 15:18:57 +0300 |
commit | 7ebb7061339f242b9ffd9fd8a7ad1f172d341666 (patch) | |
tree | c7372f3e65ba389c1c764c257873295c276cb7bd /Lib/test/test_cgi.py | |
parent | 6e18e04273877e04da0c9516d9c016e650bc72ec (diff) | |
download | cpython-git-7ebb7061339f242b9ffd9fd8a7ad1f172d341666.tar.gz |
Restore the global state of the log vars, so that test_cgi can be run twice without failures.
Diffstat (limited to 'Lib/test/test_cgi.py')
-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 d745199464..c42db4e70d 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): |