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) # Run everything but black etp = deepcopy(ptr_tests_fixtures.EXPECTED_TEST_PARAMS) del etp["run_black"] fake_no_black_tests_to_run = {fake_setup_py: etp} self.assertEqual( self.loop.run_until_complete( ptr._test_steps_runner( 69, fake_no_black_tests_to_run, fake_setup_py, fake_venv_path, {}, True, )), # Windows will not run pyre (None, 6) if ptr.WINDOWS else (None, 7), ) if ptr.WINDOWS and version_info >= (3, 7): # No pyre + black expected = (None, 6) elif ptr.WINDOWS: # No pyre expected = (None, 7) else: # Running all steps on everything else expected = (None, 8) fake_tests_to_run = { fake_setup_py: ptr_tests_fixtures.EXPECTED_TEST_PARAMS } self.assertEqual( self.loop.run_until_complete( ptr._test_steps_runner( 69, fake_tests_to_run, fake_setup_py, fake_venv_path, {}, {}, True, )), expected, ) # Ensure we've "printed coverage" self.assertTrue(mock_print.called)
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) # Run everything but black etp = deepcopy(ptr_tests_fixtures.EXPECTED_TEST_PARAMS) del etp["run_black"] fake_no_black_tests_to_run = {fake_setup_py: etp} self.assertEqual( self.loop.run_until_complete( ptr._test_steps_runner( 69, fake_no_black_tests_to_run, fake_setup_py, fake_venv_path, {}, True, ) ), (None, 6), ) # Run everything including black fake_tests_to_run = {fake_setup_py: ptr_tests_fixtures.EXPECTED_TEST_PARAMS} self.assertEqual( self.loop.run_until_complete( ptr._test_steps_runner( 69, fake_tests_to_run, fake_setup_py, fake_venv_path, {}, {}, True, ) ), (None, 7), ) # Ensure we've "printed coverage" self.assertTrue(mock_print.called)
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) fake_tests_to_run = { fake_setup_py: ptr_tests_fixtures.EXPECTED_TEST_PARAMS } self.assertEqual( self.loop.run_until_complete( ptr._test_steps_runner(69, fake_tests_to_run, fake_setup_py, fake_venv_path, {}, True)), (None, 5), ) # Ensure we've "printed coverage" self.assertTrue(mock_print.called)
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( ptr._test_steps_runner(*tsr_params) # pyre-ignore ), (None, 7) if no_pyre else (None, 8), ) # Run everything but black + no print cov etp = deepcopy(ptr_tests_fixtures.EXPECTED_TEST_PARAMS) del etp["run_black"] tsr_params[1] = {fake_setup_py: etp} tsr_params[7] = False self.assertEqual( self.loop.run_until_complete( ptr._test_steps_runner(*tsr_params) # pyre-ignore ), (None, 6) if no_pyre else (None, 7), ) # Run everything but test_suite with print_cov expected_no_pyre_tests = (None, 5) if no_pyre else (None, 6) etp = deepcopy(ptr_tests_fixtures.EXPECTED_TEST_PARAMS) del etp["test_suite"] del etp["required_coverage"] tsr_params[1] = {fake_setup_py: etp} tsr_params[7] = True self.assertEqual( self.loop.run_until_complete( ptr._test_steps_runner(*tsr_params) # pyre-ignore ), expected_no_pyre_tests, ) # Ensure we've "printed coverage" self.assertEqual(mock_print.call_count, 1)