summaryrefslogtreecommitdiff
path: root/Lib/test/test_cgi.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2011-07-14 15:18:57 +0300
committerEzio Melotti <ezio.melotti@gmail.com>2011-07-14 15:18:57 +0300
commit5f303610e1444b100e08fefba227d244e1eb8ed8 (patch)
treed0eae42b07f20b319688843b30dbfe695705b857 /Lib/test/test_cgi.py
parentb1eec9bd0d8dab1dc20d05b81bca5e7a07d17cdf (diff)
downloadcpython-5f303610e1444b100e08fefba227d244e1eb8ed8.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.py8
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):