예제 #1
0
파일: test__utils.py 프로젝트: juju/txjuju
    def test_run_executable_does_not_exist(self):
        """
        Executable.run() fails if the executable does not exist.
        """
        filename = self._resolve_executable("does-not-exist")
        exe = Executable(filename)

        with self.assertRaises(ExecutableNotFoundError):
            exe.run()
예제 #2
0
    def test_run(self):
        """
        Executable.run() runs the command and returns nothing.
        """
        filename = self._write_executable("script")
        exe = Executable(filename, {"SPAM": "eggs"})
        with tempfile.NamedTemporaryFile() as outfile:
            exe.run("x", "-y", "z", stdout=outfile)
            outfile.seek(0)
            out = outfile.read()

        self.assertTrue(out.startswith("x -y z\n"))
        self.assertIn("SPAM=eggs\n", out)