Exemplo n.º 1
0
def test__read_stdout():
    """
    Test we can yield stdout
    """
    with patch("subprocess.Popen") as popen_mock:
        popen_mock.stdout.readline.return_value = "test"
        assert next(script._read_stdout(popen_mock)) == "test"
Exemplo n.º 2
0
 def test__read_stdout(self):
     '''
     Test we can yield stdout
     '''
     with patch('subprocess.Popen') as popen_mock:
         popen_mock.stdout.readline.return_value = 'test'
         self.assertEqual(next(script._read_stdout(popen_mock)), 'test')
Exemplo n.º 3
0
def test__read_stdout_terminates_properly():
    """
    Test that _read_stdout terminates with the sentinel
    """
    with patch("subprocess.Popen") as popen_mock:
        popen_mock.stdout.readline.return_value = b""
        with pytest.raises(StopIteration):
            next(script._read_stdout(popen_mock))