def test_resume(populated_suite): fail_index = populated_suite.fail_in_middle() result = populated_suite.run(stop_on_error=True) save_resume_state(result.session.results) resumed = get_tests_to_resume(result.session.id) assert len(resumed) + result.session.results.get_num_started() - 1 == len(populated_suite) assert resumed[0].endswith(populated_suite[fail_index].function_name)
def test_resume(suite): fail_index = len(suite) // 2 suite[fail_index].when_run.fail() for index, test in enumerate(suite): if index > fail_index: test.expect_not_run() result = suite.run(additional_args=['-x']) resumed = get_tests_to_resume(result.session.id) assert len(resumed) + result.session.results.get_num_started() - 1 == len( suite)
def test_resume_with_parametrization(suite, suite_test): num_values1 = 3 num_values2 = 5 suite_test.add_parameter(num_values=num_values1) suite_test.add_parameter(num_values=num_values2) fail_index = len(suite) // 2 suite[fail_index].when_run.fail() summary = suite.run() resumed = get_tests_to_resume(summary.session.id) assert len(summary.get_all_results_for_test( suite_test)) == num_values1 * num_values2 assert len(resumed) == 1 assert resumed[0].function_name == suite[fail_index].name
def test_resume(suite): fail_index = len(suite) // 2 suite[fail_index].when_run.fail() for index, test in enumerate(suite): if index > fail_index: test.expect_not_run() result = suite.run(additional_args=['-x']) save_resume_state(result.session.results) resumed = get_tests_to_resume(result.session.id) assert len(resumed) + result.session.results.get_num_started() - 1 == len(suite) assert resumed[0].endswith(suite[fail_index].id)
def test_parallel_resume(parallel_suite): parallel_suite[0].when_run.fail() result = parallel_suite.run() resumed = get_tests_to_resume(result.session.id) assert len(resumed) == 1
def test_resume_no_session(): with pytest.raises(CannotResume): get_tests_to_resume("nonexisting_session")