diff --git a/tests/commands/run/test_integration.py b/tests/commands/run/test_integration.py index 2fc4fce4..f20e66a0 100644 --- a/tests/commands/run/test_integration.py +++ b/tests/commands/run/test_integration.py @@ -37,6 +37,36 @@ def test_simple(create_package, time_tool): assert config["sinol_expected_scores"] == expected_scores +@pytest.mark.parametrize("create_package", [get_simple_package_path(), get_verify_status_package_path(), + get_checker_package_path(), get_library_package_path(), + get_library_string_args_package_path(), get_limits_package_path(), + get_override_limits_package_path(), get_icpc_package_path()], + indirect=True) +def test_wrong_solution(create_package, time_tool): + """ + Test if running after changing solution works. + """ + package_path = create_package + create_ins_outs(package_path) + parser = configure_parsers() + args = parser.parse_args(["run", "--time-tool", time_tool]) + command = Command() + + # First run to create cache. + command.run(args) + + # Change solution. + task_id = package_util.get_task_id() + with open(os.path.join(os.path.join(package_path, "prog", f"{task_id}.cpp")), "w") as f: + f.write("int main() { return 0; }") + + # Second run. + with pytest.raises(SystemExit) as e: + command.run(args) + assert e.type == SystemExit + assert e.value.code == 1 + + @pytest.mark.parametrize("create_package", [get_simple_package_path(), get_verify_status_package_path(), get_checker_package_path(), get_library_package_path(), get_library_string_args_package_path(), get_limits_package_path(),