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)
def __init__(self, pty_recorder=None): self.pty_recorder = pty_recorder if pty_recorder is not None else PtyRecorder( )
def test_record_command_returns_stdout_instance(self): pty_recorder = PtyRecorder() output = pty_recorder.record_command('ls -l') assert_equal(Stdout, type(output))
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