Add cgi.closelog() function to close the log file

This commit is contained in:
Victor Stinner 2011-07-14 22:28:36 +02:00
parent f64f9e9ec1
commit d33344a030
3 changed files with 13 additions and 8 deletions

View file

@ -155,13 +155,7 @@ class CgiTests(unittest.TestCase):
cgi.logfp = None
cgi.logfile = "/dev/null"
cgi.initlog("%s", "Testing log 3")
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)
self.addCleanup(cgi.closelog)
cgi.log("Testing log 4")
def test_fieldstorage_readline(self):