Example #1
0
 def test_communicate_with_timeout(self):
     proc = FakeProcess({}, {'stdout': BytesIO(_b('foo'))})
     self.assertEqual((_b('foo'), ''), proc.communicate(timeout=10))
Example #2
0
 def test_communicate_with_input(self):
     proc = FakeProcess({}, {'stdout': BytesIO(_b('foo'))})
     self.assertEqual((_b('foo'), ''), proc.communicate(input=_b("bar")))
Example #3
0
 def test_communicate_with_input_and_stdin(self):
     stdin = BytesIO()
     proc = FakeProcess({}, {'stdin': stdin})
     proc.communicate(input=_b("hello"))
     self.assertEqual(_b("hello"), stdin.getvalue())
Example #4
0
 def test_communicate_with_timeout(self):
     proc = FakeProcess({}, {'stdout': BytesIO(_b('foo'))})
     self.assertEqual((_b('foo'), ''), proc.communicate(timeout=10))
Example #5
0
 def test_communicate_with_out(self):
     proc = FakeProcess({}, {'stdout': BytesIO(_b('foo'))})
     self.assertEqual((_b('foo'), ''), proc.communicate())
     self.assertEqual(0, proc.returncode)
Example #6
0
 def test_poll(self):
     proc = FakeProcess({}, {})
     self.assertIs(None, proc.poll())
     proc.communicate()
     self.assertEqual(0, proc.poll())
Example #7
0
 def test_wait_with_timeout_and_endtime(self):
     proc = FakeProcess({}, {})
     self.assertEqual(0, proc.wait(timeout=4, endtime=7))
Example #8
0
 def test_wait(self):
     proc = FakeProcess({}, {})
     proc.returncode = 45
     self.assertEqual(45, proc.wait())
Example #9
0
 def test_communicate(self):
     proc = FakeProcess({}, {})
     self.assertEqual(('', ''), proc.communicate())
     self.assertEqual(0, proc.returncode)
Example #10
0
 def test_communicate_with_input(self):
     proc = FakeProcess({}, {'stdout': BytesIO(_b('foo'))})
     self.assertEqual((_b('foo'), ''), proc.communicate(input=_b("bar")))
Example #11
0
 def test_wait_with_timeout_and_endtime(self):
     proc = FakeProcess({}, {})
     self.assertEqual(0 , proc.wait(timeout=4, endtime=7))
Example #12
0
 def test_poll_with_returncode(self):
     proc = FakeProcess({}, {})
     proc.communicate()
     self.assertEqual(0, proc.poll())
Example #13
0
 def test_poll(self):
     proc = FakeProcess({}, {})
     self.assertIs(None, proc.poll())
     proc.communicate()
     self.assertEqual(0, proc.poll())
Example #14
0
 def test_args(self):
     proc = FakeProcess({"args": ["ls", "-lh"]}, {})
     proc.returncode = 45
     self.assertEqual(45, proc.wait())
     self.assertEqual(proc.args, ["ls", "-lh"])
Example #15
0
 def test_args(self):
     proc = FakeProcess({"args": ["ls", "-lh"]}, {})
     proc.returncode = 45
     self.assertEqual(45, proc.wait())
     self.assertEqual(proc.args, ["ls", "-lh"])
Example #16
0
 def test_communicate_with_out(self):
     proc = FakeProcess({}, {'stdout': BytesIO(_b('foo'))})
     self.assertEqual((_b('foo'), ''), proc.communicate())
     self.assertEqual(0, proc.returncode)
Example #17
0
 def test_kill(self):
     proc = FakeProcess({}, {})
     self.assertIs(None, proc.kill())
Example #18
0
 def test_kill(self):
     proc = FakeProcess({}, {})
     self.assertIs(None, proc.kill())
Example #19
0
 def test_poll_with_returncode(self):
     proc = FakeProcess({}, {})
     proc.communicate()
     self.assertEqual(0, proc.poll())
Example #20
0
 def test_communicate(self):
     proc = FakeProcess({}, {})
     self.assertEqual(('', ''), proc.communicate())
     self.assertEqual(0, proc.returncode)
Example #21
0
 def test_wait(self):
     proc = FakeProcess({}, {})
     proc.returncode = 45
     self.assertEqual(45, proc.wait())
Example #22
0
 def test_communicate_with_input_and_stdin(self):
     stdin = BytesIO()
     proc = FakeProcess({}, {'stdin': stdin})
     proc.communicate(input=_b("hello"))
     self.assertEqual(_b("hello"), stdin.getvalue())