Преглед на файлове

Add test for handling a read event with no data

Mike Naberezny преди 11 години
родител
ревизия
4080b472b9
променени са 1 файла, в които са добавени 12 реда и са изтрити 0 реда
  1. 12 0
      supervisor/tests/test_dispatchers.py

+ 12 - 0
supervisor/tests/test_dispatchers.py

@@ -68,6 +68,18 @@ class POutputDispatcherTests(unittest.TestCase):
         self.assertEqual(dispatcher.handle_read_event(), None)
         self.assertEqual(dispatcher.output_buffer, 'abc')
 
+    def test_handle_read_event_no_data_closes(self):
+        options = DummyOptions()
+        options.readfd_result = ''
+        config = DummyPConfig(options, 'process1', '/bin/process1',
+                              stdout_capture_maxbytes=100)
+        process = DummyProcess(config)
+        dispatcher = self._makeOne(process)
+        self.assertFalse(dispatcher.closed)
+        self.assertEqual(dispatcher.handle_read_event(), None)
+        self.assertEqual(dispatcher.output_buffer, '')
+        self.assertTrue(dispatcher.closed)
+
     def test_handle_error(self):
         options = DummyOptions()
         config = DummyPConfig(options, 'test', '/test')