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"
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')
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))