def test_exec_without_timeout_stderr(self): status, stdout, stderr = executils.exec_cmd( "echo 'hey' 1>&2", timeout=0.1, current_working_directory='/tmp') self.assertEqual('hey\n', stderr) self.assertEqual('', stdout)
def test_exec_partial_stdout(self): status, stdout, stderr = executils.exec_cmd("yes", timeout=0.1) self.assertTrue(len(stdout) > 5) self.assertTrue(stdout.startswith('y')) self.assertTrue(stderr.startswith('Timeout'))
def test_exec_partial_stderr(self): status, stdout, stderr = executils.exec_cmd( "yes 1>&2", timeout=0.1, current_working_directory='/tmp') self.assertTrue(len(stdout) == 0) self.assertTrue(len(stderr) > 5) self.assertTrue(stderr.startswith('Timeout'))
def test_exec_cmd_with_timeout(self): status, stdout, stderr = executils.exec_cmd( "sleep 1", timeout=0.1, current_working_directory='/tmp') self.assertEqual(1, status)