Skip to content

Commit

Permalink
Add test (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
MasloMaslane authored Oct 4, 2023
1 parent 48fef67 commit 0f56eb0
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/commands/run/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 0f56eb0

Please sign in to comment.