예제 #1
0
    def test_gen_output(self) -> None:
        stdout, stderr = self.loop.run_until_complete(
            ptr._gen_check_output(("/bin/echo", )))
        self.assertEqual(stdout, b"\n")
        self.assertEqual(stderr, b"")

        with self.assertRaises(CalledProcessError):
            false = "/usr/bin/false" if system() == "Darwin" else "/bin/false"
            self.loop.run_until_complete(ptr._gen_check_output((false, )))
예제 #2
0
    def test_gen_output(self) -> None:
        test_cmd = ("echo.exe", "''") if ptr.WINDOWS else ("/bin/echo",)

        stdout, stderr = self.loop.run_until_complete(ptr._gen_check_output(test_cmd))
        self.assertTrue(b"\n" in stdout)
        self.assertEqual(stderr, None)

        if ptr.WINDOWS:
            return

        # TODO: Test this on Windows and ensure we capture failures corerctly
        with self.assertRaises(CalledProcessError):
            if ptr.MACOSX:
                false = "/usr/bin/false"
            else:
                false = "/bin/false"

            self.loop.run_until_complete(ptr._gen_check_output((false,)))