Skip to content

Commit d9f2d95

Browse files
committed
test(golden): run canonical fixture only on cp313
1 parent 81e2e07 commit d9f2d95

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

tests/test_detector_golden.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,35 @@
11
from __future__ import annotations
22

33
import json
4+
import sys
45
from dataclasses import asdict
56
from pathlib import Path
67

8+
import pytest
9+
710
from codeclone.extractor import extract_units_from_source
811
from codeclone.normalize import NormalizationConfig
912
from codeclone.report import build_block_groups, build_groups
1013
from codeclone.scanner import module_name_from_path
1114

15+
CANONICAL_GOLDEN_PYTHON_TAG = "cp313"
16+
17+
18+
def _runtime_python_tag() -> str:
19+
impl = sys.implementation.name
20+
major, minor = sys.version_info[:2]
21+
prefix = "cp" if impl == "cpython" else impl[:2]
22+
return f"{prefix}{major}{minor}"
23+
24+
25+
pytestmark = pytest.mark.skipif(
26+
_runtime_python_tag() != CANONICAL_GOLDEN_PYTHON_TAG,
27+
reason=(
28+
"Golden detector fixture is canonicalized for "
29+
f"{CANONICAL_GOLDEN_PYTHON_TAG}; run contract/invariant tests on other tags."
30+
),
31+
)
32+
1233

1334
def _detect_group_keys(project_root: Path) -> tuple[list[str], list[str]]:
1435
cfg = NormalizationConfig()

0 commit comments

Comments
 (0)