[Python-checkins] cpython (3.2): Restore the global state of the log vars, so that test_cgi can be run twice
ezio.melotti
python-checkins at python.org
Thu Jul 14 14:57:24 CEST 2011
http://hg.python.org/cpython/rev/530ba6c7e578
changeset: 71324:530ba6c7e578
branch: 3.2
parent: 71320:b82237a29824
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Thu Jul 14 15:18:57 2011 +0300
summary:
Restore the global state of the log vars, so that test_cgi can be run twice without failures.
files:
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
--- a/Lib/test/test_cgi.py
+++ b/Lib/test/test_cgi.py
@@ -155,7 +155,13 @@
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):
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list