diff --git a/rust/ql/integration-tests/hello-project/test_project.py b/rust/ql/integration-tests/hello-project/test_project.py index a8c5e3384fb..7f53e78f7d4 100644 --- a/rust/ql/integration-tests/hello-project/test_project.py +++ b/rust/ql/integration-tests/hello-project/test_project.py @@ -19,14 +19,25 @@ def test_do_not_print_env(codeql, rust, rust_edition, cargo, check_env_not_dumpe @pytest.mark.ql_test("steps.ql", expected=".cargo.expected") @pytest.mark.parametrize(("rust_edition", "compression", "suffix"), [ - pytest.param(2024, "gzip", ".gz", id="gzip"), - pytest.param(2024, "zstd", ".zst", id="zstd"), + pytest.param(2024, "none", [], id="none"), + pytest.param(2024, "gzip", [".gz"], id="gzip"), + pytest.param(2024, "zstd", [".zst"], id="zstd"), ]) def test_compression(codeql, rust, rust_edition, compression, suffix, cargo, rust_check_diagnostics, cwd): - codeql.database.create(cleanup=False, _env={ - "CODEQL_EXTRACTOR_RUST_TRAP_COMPRESSION": compression, - }) + codeql.database.create( + _env={ + "CODEQL_EXTRACTOR_RUST_OPTION_TRAP_COMPRESSION": compression, + } + ) trap_files = [*(cwd / "test-db" / "trap").rglob("*.trap*")] - assert trap_files - files_with_wrong_format = [f for f in trap_files if f.suffix != suffix and f.name != "metadata.trap.gz"] - assert not files_with_wrong_format, f"Found trap files with wrong format: {files_with_wrong_format}" + assert trap_files, "No trap files found" + expected_suffixes = [".trap"] + suffix + + def is_of_expected_format(file): + return file.name == "metadata.trap.gz" or \ + file.suffixes[-len(expected_suffixes):] == expected_suffixes + + files_with_wrong_format = [ + f for f in trap_files if not is_of_expected_format(f) + ] + assert not files_with_wrong_format, f"Found trap files with wrong format"