Browse Source

Add test for handling a read event with no data

Mike Naberezny 11 năm trước cách đây
mục cha
commit
4080b472b9
1 tập tin đã thay đổi với 12 bổ sung0 xóa
  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')