Explorar o código

Add coverage for close() on Python 2

Mike Naberezny %!s(int64=10) %!d(string=hai) anos
pai
achega
815f1e05e0
Modificáronse 1 ficheiros con 9 adicións e 0 borrados
  1. 9 0
      supervisor/tests/test_loggers.py

+ 9 - 0
supervisor/tests/test_loggers.py

@@ -87,6 +87,15 @@ class BareHandlerTests(HandlerTests, unittest.TestCase):
         inst.close() # shouldn't raise
         self.assertTrue(inst.closed)
 
+    def test_close_stream_handles_fileno_ioerror(self):
+        stream = DummyStream()
+        def raise_ioerror():
+            raise IOError()
+        stream.fileno = raise_ioerror
+        inst = self._makeOne(stream=stream)
+        inst.close() # shouldn't raise
+        self.assertTrue(inst.closed)
+
     def test_emit_gardenpath(self):
         stream = DummyStream()
         inst = self._makeOne(stream=stream)