Exemplo n.º 1
0
    def test_record_command_writes_to_stdout(self):
        pty_recorder = PtyRecorder()
        output = FakeStdout()

        command = ['python3', '-c', "import sys; import time; sys.stdout.write(\'foo\'); sys.stdout.flush(); time.sleep(0.01); sys.stdout.write(\'bar\')"]
        pty_recorder.record_command(command, output)

        assert_equal([b'foo', b'bar'], output.data)
Exemplo n.º 2
0
    def test_record_command_writes_to_stdout(self):
        pty_recorder = PtyRecorder()
        output = FakeStdout()

        command = ['python3', '-c', "import sys; import time; sys.stdout.write(\'foo\'); sys.stdout.flush(); time.sleep(0.01); sys.stdout.write(\'bar\')"]
        pty_recorder.record_command(command, output)

        assert_equal([b'foo', b'bar'], output.data)
Exemplo n.º 3
0
    def test_record_command_writes_to_stdout(self):
        pty_recorder = PtyRecorder()
        output = FakeStdout()

        command = [
            "python3",
            "-c",
            "import sys; import time; sys.stdout.write('foo'); sys.stdout.flush(); time.sleep(0.01); sys.stdout.write('bar')",
        ]
        pty_recorder.record_command(command, output)

        assert_equal([b"foo", b"bar"], output.data)
Exemplo n.º 4
0
 def __init__(self, pty_recorder=None):
     self.pty_recorder = pty_recorder if pty_recorder is not None else PtyRecorder(
     )
Exemplo n.º 5
0
    def test_record_command_returns_stdout_instance(self):
        pty_recorder = PtyRecorder()

        output = pty_recorder.record_command('ls -l')

        assert_equal(Stdout, type(output))
Exemplo n.º 6
0
    def test_record_command_returns_stdout_instance(self):
        pty_recorder = PtyRecorder()

        output = pty_recorder.record_command('ls -l')

        assert_equal(Stdout, type(output))
Exemplo n.º 7
0
 def __init__(self, pty_recorder=None, env=None):
     self.pty_recorder = pty_recorder if pty_recorder is not None else PtyRecorder(
     )
     self.env = env if env is not None else os.environ