How to use the ptr.WINDOWS function in ptr

To help you get started, we’ve selected a few ptr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facebookincubator / ptr / ptr_tests.py View on Github external
def test_test_steps_runner(self, mock_print: Mock) -> None:
        with TemporaryDirectory() as td:
            td_path = Path(td)
            fake_setup_py = td_path / "setup.py"
            fake_venv_path = td_path / "unittest_venv"
            fake_venv_lib_path = fake_venv_path / "lib"
            fake_venv_lib_path.mkdir(parents=True)
            # Windows can not run pyre
            no_pyre = ptr.WINDOWS
            tsr_params = [
                69,  # test_start_time
                {fake_setup_py: {}},  # tests_to_run
                fake_setup_py,
                fake_venv_path,
                {},  # env
                {},  # stats
                True,  # error_on_warnings
                False,  # print_cov
            ]

            # Run everything + with print_cov
            tsr_params[1] = {fake_setup_py: ptr_tests_fixtures.EXPECTED_TEST_PARAMS}
            tsr_params[7] = True
            self.assertEqual(
                self.loop.run_until_complete(
github facebookincubator / ptr / ptr_tests.py View on Github external
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,)))