diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f352f4b..18e99fe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: ## Check JSON schemata - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.37.2 + rev: 0.37.3 hooks: - id: check-github-workflows priority: 0 @@ -45,14 +45,14 @@ repos: ## Check pyproject.toml file - repo: https://github.com/henryiii/validate-pyproject-schema-store - rev: 2026.06.12 + rev: 2026.06.14 hooks: - id: validate-pyproject priority: 0 ## Ensure uv.lock is up to date - repo: https://github.com/astral-sh/uv-pre-commit - rev: 0.11.19 + rev: 0.11.21 hooks: - id: uv-lock priority: 0 @@ -102,7 +102,7 @@ repos: ## Format configuration files with prettier - repo: https://github.com/rbubley/mirrors-prettier - rev: v3.8.3 + rev: v3.8.4 hooks: - id: prettier types_or: [yaml, markdown, html, css, scss, javascript, json, json5] @@ -128,7 +128,7 @@ repos: ## Format and lint Python files with ruff - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.15.16 + rev: v0.15.17 hooks: - id: ruff-check require_serial: true @@ -139,7 +139,7 @@ repos: ## Check Python types with ty - repo: https://github.com/astral-sh/ty-pre-commit - rev: v0.0.47 + rev: v0.0.49 hooks: - id: ty args: [--only-dev] diff --git a/test/test_plugin.py b/test/test_plugin.py index a4c2942..caacaad 100644 --- a/test/test_plugin.py +++ b/test/test_plugin.py @@ -50,7 +50,7 @@ MLIR_FILE_TO_CATALYST = "3_AfterToCatalystQuantum.mlir" -@pytest.fixture(autouse=True) +@pytest.fixture def _cleanup_mlir_files() -> Generator[None, None, None]: """Clean up MLIR files before and after each test to ensure test isolation. @@ -240,6 +240,7 @@ def _verify_roundtrip( _run_filecheck(mlir_after_roundtrip, check_after, f"{test_name}: MQTOpt to CatalystQuantum") +@pytest.mark.usefixtures("_cleanup_mlir_files") def test_paulix_roundtrip() -> None: """Test roundtrip conversion of the PauliX gate.""" @@ -288,6 +289,7 @@ def module() -> Any: # noqa: ANN401 _verify_roundtrip("PauliX", check_mlir_before, check_after_mqtopt, check_after_catalyst) +@pytest.mark.usefixtures("_cleanup_mlir_files") def test_pauliy_roundtrip() -> None: """Test roundtrip conversion of the PauliY gate.""" @@ -336,6 +338,7 @@ def module() -> Any: # noqa: ANN401 _verify_roundtrip("PauliY", check_mlir_before, check_after_mqtopt, check_after_catalyst) +@pytest.mark.usefixtures("_cleanup_mlir_files") def test_pauliz_roundtrip() -> None: """Test roundtrip conversion of the PauliZ gate.""" @@ -384,6 +387,7 @@ def module() -> Any: # noqa: ANN401 _verify_roundtrip("PauliZ", check_mlir_before, check_after_mqtopt, check_after_catalyst) +@pytest.mark.usefixtures("_cleanup_mlir_files") def test_hadamard_roundtrip() -> None: """Test roundtrip conversion of the Hadamard gate.""" @@ -423,6 +427,7 @@ def module() -> Any: # noqa: ANN401 _verify_roundtrip("Hadamard", check_mlir_before, check_after_mqtopt, check_after_catalyst) +@pytest.mark.usefixtures("_cleanup_mlir_files") def test_s_gate_roundtrip() -> None: """Test roundtrip conversion of the S gate.""" @@ -461,6 +466,7 @@ def module() -> Any: # noqa: ANN401 _verify_roundtrip("S", check_mlir_before, check_after_mqtopt, check_after_catalyst) +@pytest.mark.usefixtures("_cleanup_mlir_files") def test_t_gate_roundtrip() -> None: """Test roundtrip conversion of the T gate.""" @@ -500,6 +506,7 @@ def module() -> Any: # noqa: ANN401 _verify_roundtrip("T", check_mlir_before, check_after_mqtopt, check_after_catalyst) +@pytest.mark.usefixtures("_cleanup_mlir_files") def test_rx_gate_roundtrip() -> None: """Test roundtrip conversion of the RX gate.""" @@ -543,6 +550,7 @@ def module() -> Any: # noqa: ANN401 _verify_roundtrip("RX", check_mlir_before, check_after_mqtopt, check_after_catalyst) +@pytest.mark.usefixtures("_cleanup_mlir_files") def test_ry_gate_roundtrip() -> None: """Test roundtrip conversion of the RY gate.""" @@ -586,6 +594,7 @@ def module() -> Any: # noqa: ANN401 _verify_roundtrip("RY", check_mlir_before, check_after_mqtopt, check_after_catalyst) +@pytest.mark.usefixtures("_cleanup_mlir_files") def test_rz_gate_roundtrip() -> None: """Test roundtrip conversion of the RZ gate.""" @@ -629,6 +638,7 @@ def module() -> Any: # noqa: ANN401 _verify_roundtrip("RZ", check_mlir_before, check_after_mqtopt, check_after_catalyst) +@pytest.mark.usefixtures("_cleanup_mlir_files") def test_phaseshift_gate_roundtrip() -> None: """Test roundtrip conversion of the PhaseShift gate.""" @@ -668,6 +678,7 @@ def module() -> Any: # noqa: ANN401 _verify_roundtrip("PhaseShift", check_mlir_before, check_after_mqtopt, check_after_catalyst) +@pytest.mark.usefixtures("_cleanup_mlir_files") def test_swap_gate_roundtrip() -> None: """Test roundtrip conversion of the SWAP gate.""" @@ -707,6 +718,7 @@ def module() -> Any: # noqa: ANN401 _verify_roundtrip("SWAP", check_mlir_before, check_after_mqtopt, check_after_catalyst) +@pytest.mark.usefixtures("_cleanup_mlir_files") def test_toffoli_gate_roundtrip() -> None: """Test roundtrip conversion of the Toffoli gate."""