def test_run_executable_does_not_exist(self): """ Executable.run_out() fails if the executable does not exist. """ filename = self._resolve_executable("does-not-exist") exe = Executable(filename) with self.assertRaises(ExecutableNotFoundError): exe.run_out()
def test_run_out(self): """ Executable.run_out() runs the command and returns stdout. """ filename = self._write_executable("script") self.assertTrue(os.path.exists(filename)) exe = Executable(filename, {"SPAM": "eggs"}) out = exe.run_out("x", "-y", "z") self.assertTrue(out.startswith("x -y z\n")) self.assertIn("SPAM=eggs\n", out)