def test_testcase_trimming(runpath, listing_obj, expected_output): multitest_x = MultiTest(name="Primary", suites=[ParametrizedSuite()]) plan = TestplanMock(name="plan", test_lister=listing_obj, runpath=runpath) with captured_logging(TESTPLAN_LOGGER) as log_capture: plan.add(multitest_x) assert log_capture.output == expected_output result = plan.run() assert len(result.test_report) == 0, "No tests should be run."
def test_testcase_trimming(listing_obj, expected_output): multitest_x = MultiTest(name="Primary", suites=[ParametrizedSuite()]) plan = Testplan(name="plan", parse_cmdline=False, test_lister=listing_obj) with log_propagation_disabled(TESTPLAN_LOGGER): with captured_logging(TESTPLAN_LOGGER) as log_capture: plan.add(multitest_x) assert log_capture.output == expected_output result = plan.run() assert len(result.test_report) == 0, "No tests should be run."
def test_command_line_listing(runpath, cmdline_args, expected_output): multitest_x = MultiTest(name="Primary", suites=[Beta(), Alpha()]) multitest_y = MultiTest(name="Secondary", suites=[Gamma()]) with argv_overridden(*cmdline_args): plan = TestplanMock(name="plan", parse_cmdline=True, runpath=runpath) with captured_logging(TESTPLAN_LOGGER) as log_capture: plan.add(multitest_x) plan.add(multitest_y) result = plan.run() assert log_capture.output == expected_output assert len(result.test_report) == 0, "No tests should be run."
def test_hobbestest_listing(binary_dir, expected_output): binary_path = os.path.join(binary_dir, 'hobbes-test') cmdline_args = ['--list'] with argv_overridden(*cmdline_args): plan = Testplan(name='plan', parse_cmdline=True) with log_propagation_disabled(TESTPLAN_LOGGER): with captured_logging(TESTPLAN_LOGGER) as log_capture: plan.add(HobbesTest(name='MyHobbesTest', driver=binary_path, tests=['Hog', 'Net', 'Recursives'])) result = plan.run() print(log_capture.output) assert log_capture.output == expected_output assert len(result.test_report) == 0, 'No tests should be run.'
def test_command_line_listing(cmdline_args, expected_output): multitest_x = MultiTest(name='Primary', suites=[Beta(), Alpha()]) multitest_y = MultiTest(name='Secondary', suites=[Gamma()]) with argv_overridden(*cmdline_args): plan = Testplan(name='plan', parse_cmdline=True) with log_propagation_disabled(TESTPLAN_LOGGER): with captured_logging(TESTPLAN_LOGGER) as log_capture: plan.add(multitest_x) plan.add(multitest_y) result = plan.run() assert log_capture.output == expected_output assert len(result.test_report) == 0, 'No tests should be run.'
def test_hobbestest_listing(binary_dir, expected_output): binary_path = os.path.join(binary_dir, "hobbes-test") cmdline_args = ["--list"] with argv_overridden(*cmdline_args): plan = TestplanMock(name="plan", parse_cmdline=True) with captured_logging(TESTPLAN_LOGGER) as log_capture: plan.add( HobbesTest( name="My HobbesTest", binary=binary_path, tests=["Hog", "Net", "Recursives"], )) result = plan.run() print(log_capture.output) assert log_capture.output == expected_output assert len(result.test_report) == 0, "No tests should be run."
def test_programmatic_listing(runpath, listing_obj, filter_obj, sorter_obj, expected_output): multitest_x = MultiTest(name="Primary", suites=[Beta(), Alpha()]) multitest_y = MultiTest(name="Secondary", suites=[Gamma()]) plan = TestplanMock( name="plan", test_lister=listing_obj, test_filter=filter_obj, test_sorter=sorter_obj, runpath=runpath, ) with captured_logging(TESTPLAN_LOGGER) as log_capture: plan.add(multitest_x) plan.add(multitest_y) assert log_capture.output == expected_output result = plan.run() assert len(result.test_report) == 0, "No tests should be run."
def test_programmatic_listing(listing_obj, filter_obj, sorter_obj, expected_output): multitest_x = MultiTest(name='Primary', suites=[Beta(), Alpha()]) multitest_y = MultiTest(name='Secondary', suites=[Gamma()]) plan = Testplan( name='plan', parse_cmdline=False, test_lister=listing_obj, test_filter=filter_obj, test_sorter=sorter_obj, ) with log_propagation_disabled(TESTPLAN_LOGGER): with captured_logging(TESTPLAN_LOGGER) as log_capture: plan.add(multitest_x) plan.add(multitest_y) assert log_capture.output == expected_output result = plan.run() assert len(result.test_report) == 0, 'No tests should be run.'