def test_run_no_such_program(self): from check_manifest import run, Failure with self.assertRaises(Failure) as cm: run(["there-is-really-no-such-program"]) self.assertTrue( str(cm.exception).startswith( "could not run ['there-is-really-no-such-program']:" " [Errno 2] No such file or directory"))
def test_run_no_such_program(self): from check_manifest import run, Failure with self.assertRaises(Failure) as cm: run(["there-is-really-no-such-program"]) # Linux says "[Errno 2] No such file or directory" # Windows says "[Error 2] The system cannot find the file specified" # but on 3.x it's "[WinErr 2] The system cannot find the file specified" should_start_with = "could not run ['there-is-really-no-such-program']:" self.assertTrue( str(cm.exception).startswith(should_start_with), '\n%r does not start with\n%r' % (str(cm.exception), should_start_with))
def test_run_failure(self): from check_manifest import run, CommandFailed with self.assertRaises(CommandFailed) as cm: run(["false"]) self.assertEqual(str(cm.exception), "['false'] failed (status 1):\n")
def test_run_success(self): from check_manifest import run self.assertEqual(run(["true"]), "")