浏览代码

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')