def test_interactive(self): result = core.exe('echo 1', 'i') self.assertEqual(result.sreadline(), '1') self.assertRaises(StopIteration, result.sreadline) self.assertEqual(len(self.stdout_mock.lines), 0) self.assertEqual(len(self.stderr_mock.lines), 0)
def test_exe(self): result = core.exe('echo 1', '') self.assertEqual(result.stdout, '1') self.assertEqual(str(result), '1') self.assertTrue(result == '1') self.assertEqual(result.__bool__(), True) self.assertEqual(len(self.stdout_mock.lines), 0) self.assertEqual(len(self.stderr_mock.lines), 0)
def test_config_print_all(self): core.exe('echo 1', '') self.assertEqual(len(self.stdout_mock.lines), 1) self.assertEqual(self.stdout_mock.lines[0], '>>> echo 1')