Пример #1
0
    def test_lazy_run(self):
        """Command should run correctly with lazy args"""

        def f():
            return "Hello there!"

        outfile = tempfile.NamedTemporaryFile()
        a = Command("echo", f, stdout_fp=outfile.name)
        proc = a.run()
        proc.wait()
        self.assertEqual(open(outfile.name).read(), "Hello there!\n")
Пример #2
0
 def test_run(self):
     outfile = tempfile.NamedTemporaryFile()
     a = Command("echo", "Hello there!", stdout_fp=outfile.name)
     proc = a.run()
     proc.wait()
     self.assertEqual(open(outfile.name).read(), "Hello there!\n")