def test_execute_command_should_fail(): try: actual_res = utils.execute_command(['ls', '--help-does-not-exist']) except subprocess.CalledProcessError as e: assert True, "Expected exception thrown." else: assert False, "Unexpected exception (or no exception) thrown"
def test_execute_command_should_succeed(): actual_res = utils.execute_command(['ls', '--help']) assert actual_res == 0, actual_res
def test_execute_command(self): actual_res = utils.execute_command(['ls', '--help']) self.assertEquals(actual_res, 0, actual_res) actual_res = utils.execute_command(['ls', '--help-does-not-exist']) self.assertEquals(actual_res, 2, actual_res)