Esempio n. 1
0
    def test_safe_pipe_wait(self):
        command = pipe(['gzip'], ['zcat'])

        with self.assertDoesNotHang():
            out, _ = command.wait()  # No deadlock

        assert out.decode() == ''
Esempio n. 2
0
    def test_safe_pipe_wait(self):
        command = pipe(['gzip'], ['zcat'])

        with self.assertDoesNotHang():
            out, _ = command.wait()  # No deadlock

        assert out.decode() == ''
Esempio n. 3
0
 def test_failing_pipe_command(self):
     with self.assertRaises(subprocess.CalledProcessError):
         pipe(['true'], ['false'], ['true']).wait()
Esempio n. 4
0
    def test_safe_pipe_stdout_read(self):
        command = pipe(['gzip'], ['zcat'])

        with self.assertDoesNotHang():
            assert command.stdout.read().decode() == ''  # No deadlock
Esempio n. 5
0
 def test_pass_subprocess_to_pipe(self):
     proc = pipe(['printf', 'hello'], ['gzip'], run('zcat'))
     assert proc.stdout.read().decode() == 'hello'
Esempio n. 6
0
    def test_environement_on_pipe(self):
        proc = pipe(['env'], ['egrep', '^FOO='], env={'FOO': 'BAR'})

        assert proc.stdout.read().decode() == 'FOO=BAR\n'
Esempio n. 7
0
 def test_failing_pipe_command(self):
     with self.assertRaises(subprocess.CalledProcessError):
         pipe(['true'], ['false'], ['true']).wait()
Esempio n. 8
0
    def test_safe_pipe_stdout_read(self):
        command = pipe(['gzip'], ['zcat'])

        with self.assertDoesNotHang():
            assert command.stdout.read().decode() == ''  # No deadlock
Esempio n. 9
0
 def test_pass_subprocess_to_pipe(self):
     proc = pipe(['printf', 'hello'], ['gzip'], run('zcat'))
     assert proc.stdout.read().decode() == 'hello'
Esempio n. 10
0
    def test_environement_on_pipe(self):
        proc = pipe(['env'], ['egrep', '^FOO='], env={'FOO': 'BAR'})

        assert proc.stdout.read().decode() == 'FOO=BAR\n'