Example #1
0
 def test_is_running(self):
     p = LocalSubprocess(['sleep', '100'])
     p.start()
     self.assertTrue(p.is_running())
     time.sleep(0.5)
     p.stop(True)
     time.sleep(0.5)
     self.assertFalse(p.is_running())
Example #2
0
 def test_is_running(self):
     p = LocalSubprocess(['sleep', '100'])
     p.start()
     self.assertTrue(p.is_running())
     time.sleep(0.5)
     self.assertTrue(p.stop(True))
     time.sleep(0.5)
     self.assertFalse(p.is_running())
Example #3
0
 def test_start_stdout(self):
     p = LocalSubprocess(['echo', '-n', 'foo'])
     p.start()
     for i in range(10):  # expecting this command to complete in a second
         time.sleep(0.1)
         if not p.is_running():
             break
     p.wait()
     self.assertEqual(b'foo', p.stdout)
     self.assertFalse(p.is_running())
Example #4
0
 def test_start_stdout(self):
     p = LocalSubprocess(['echo', '-n', 'foo'])
     p.start()
     for i in range(10): # expecting this command to complete in a second
         time.sleep(0.1)
         if not p.is_running():
             break
     p.wait()
     self.assertEqual('foo', p.stdout)
     self.assertFalse(p.is_running())