diff --git a/src/zope/publisher/tests/test_http.py b/src/zope/publisher/tests/test_http.py index d8b59cd1..46dda013 100644 --- a/src/zope/publisher/tests/test_http.py +++ b/src/zope/publisher/tests/test_http.py @@ -74,7 +74,8 @@ def getLogMessage(self): # tempfiles have different types on different platforms, therefore use # this "canonical" way of finding out the type. -TempFileType = tempfile.TemporaryFile().__class__ +with tempfile.TemporaryFile() as t: + TempFileType = t.__class__ class HTTPInputStreamTests(unittest.TestCase):