mirror of
https://github.com/Imbad0202/academic-research-skills.git
synced 2026-09-14 13:51:17 +08:00
refactor(tests): move shared helpers into tests package (#311)
This commit is contained in:
-11
@@ -1,11 +0,0 @@
|
||||
"""Pytest bootstrap for repository-root test collection."""
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parent
|
||||
ROOT_STR = str(ROOT)
|
||||
|
||||
if ROOT_STR not in sys.path:
|
||||
sys.path.insert(0, ROOT_STR)
|
||||
@@ -0,0 +1,2 @@
|
||||
[tool.pytest.ini_options]
|
||||
pythonpath = ["."]
|
||||
@@ -31,7 +31,7 @@ Lifecycle ownership notes (E8/E9 — discipline rules with no lint surface):
|
||||
human terminal).
|
||||
|
||||
Reuse:
|
||||
- scripts/_test_helpers.load_json_schema / build_schema_validator (FORMAT_CHECKER)
|
||||
- tests/test_helpers.load_json_schema / build_schema_validator (FORMAT_CHECKER)
|
||||
- scripts/_next_verified_at_ms.next_verified_at_ms (D3 monotonic helper)
|
||||
- audit_snapshot is the Phase 6.1 reference for argparse subcommand pattern.
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ from typing import Mapping
|
||||
|
||||
# Dual-path import: when this module is loaded via `from scripts.slr_lineage
|
||||
# import emit` from the repo root (the namespace-package style used by
|
||||
# test_check_sprint_contract.py, _test_helpers.py, etc.), the sibling import
|
||||
# test_check_sprint_contract.py, tests/test_helpers.py, etc.), the sibling import
|
||||
# needs the `scripts.` prefix. When loaded via `import slr_lineage` after a
|
||||
# sys.path.insert (the style used by scripts/test_slr_lineage_emission.py),
|
||||
# the bare name works. Try the package form first; fall back to the sibling
|
||||
|
||||
@@ -37,7 +37,7 @@ from scripts._next_verified_at_ms import (
|
||||
rfc3339_ms,
|
||||
utc_now_ms,
|
||||
)
|
||||
from scripts._test_helpers import run_script
|
||||
from tests.test_helpers import run_script
|
||||
|
||||
REPO = Path(__file__).resolve().parent.parent
|
||||
SCRIPT = REPO / "scripts/_next_verified_at_ms.py"
|
||||
|
||||
@@ -20,7 +20,7 @@ from tempfile import TemporaryDirectory
|
||||
|
||||
import yaml
|
||||
|
||||
from scripts._test_helpers import run_script
|
||||
from tests.test_helpers import run_script
|
||||
|
||||
|
||||
SCRIPT = Path(__file__).parent / "ars_mark_read.py"
|
||||
|
||||
@@ -20,7 +20,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from scripts._test_helpers import build_schema_validator, load_json_schema
|
||||
from tests.test_helpers import build_schema_validator, load_json_schema
|
||||
|
||||
REPO = Path(__file__).resolve().parent.parent
|
||||
PASSPORT = REPO / "shared/contracts/passport"
|
||||
|
||||
@@ -1103,7 +1103,7 @@ class TestSchemaSelfValidation:
|
||||
"audit_verdict.schema.json",
|
||||
])
|
||||
def test_schema_meta_valid(self, schema_name):
|
||||
from scripts._test_helpers import load_json_schema
|
||||
from tests.test_helpers import load_json_schema
|
||||
if "audit_jsonl" in schema_name or "audit_sidecar" in schema_name or "audit_verdict" in schema_name:
|
||||
path = REPO / "shared/contracts/audit" / schema_name
|
||||
else:
|
||||
|
||||
@@ -5,7 +5,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from scripts._test_helpers import run_script
|
||||
from tests.test_helpers import run_script
|
||||
|
||||
SCRIPT = Path(__file__).resolve().parent / "check_benchmark_report.py"
|
||||
SCHEMA = Path(__file__).resolve().parent.parent / "shared" / "benchmark_report.schema.json"
|
||||
|
||||
@@ -6,7 +6,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from scripts._test_helpers import run_script
|
||||
from tests.test_helpers import run_script
|
||||
|
||||
SCRIPT = Path(__file__).resolve().parent / "check_collaboration_depth_rubric.py"
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from scripts._test_helpers import run_script
|
||||
from tests.test_helpers import run_script
|
||||
|
||||
SCRIPT = Path(__file__).resolve().parent / "check_compliance_report.py"
|
||||
SCHEMA = Path(__file__).resolve().parent.parent / "shared" / "compliance_report.schema.json"
|
||||
@@ -363,7 +363,7 @@ class TestComplianceReportValidator(unittest.TestCase):
|
||||
|
||||
def test_missing_maturity_warning_opt_in(self) -> None:
|
||||
"""With ARS_WARN_MISSING_MATURITY=1, warn when prisma_trAIce lacks protocol_maturity."""
|
||||
from scripts._test_helpers import run_script as _run_with_env
|
||||
from tests.test_helpers import run_script as _run_with_env
|
||||
report = _valid_sr_report()
|
||||
report["prisma_trAIce"].pop("protocol_maturity", None)
|
||||
with TemporaryDirectory() as tmp:
|
||||
|
||||
@@ -5,7 +5,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from scripts._test_helpers import run_skill_linter
|
||||
from tests.test_helpers import run_skill_linter
|
||||
|
||||
SCRIPT = Path(__file__).resolve().parent / "check_data_access_level.py"
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from scripts._test_helpers import run_script
|
||||
from tests.test_helpers import run_script
|
||||
from scripts.check_firm_rules_sync import CIM_SECTION_HEADER, _extract_section
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
@@ -16,7 +16,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from scripts._test_helpers import run_script
|
||||
from tests.test_helpers import run_script
|
||||
from scripts.check_passport_reset_contract import scan_duplicate_option_values
|
||||
|
||||
SCRIPT = Path(__file__).resolve().parent / "check_passport_reset_contract.py"
|
||||
|
||||
@@ -5,7 +5,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from scripts._test_helpers import run_script
|
||||
from tests.test_helpers import run_script
|
||||
|
||||
SCRIPT = Path(__file__).resolve().parent / "check_pipeline_integrity.py"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from scripts._test_helpers import run_script
|
||||
from tests.test_helpers import run_script
|
||||
|
||||
SCRIPT = Path(__file__).resolve().parent / "check_prisma_trAIce_freshness.py"
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
import textwrap
|
||||
|
||||
from scripts._test_helpers import run_script
|
||||
from tests.test_helpers import run_script
|
||||
|
||||
SCRIPT = Path(__file__).resolve().parent / "check_repro_lock.py"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from scripts._test_helpers import run_script
|
||||
from tests.test_helpers import run_script
|
||||
|
||||
SCRIPT = Path(__file__).resolve().parent / "check_sprint_contract.py"
|
||||
SCHEMA = Path(__file__).resolve().parent.parent / "shared" / "sprint_contract.schema.json"
|
||||
|
||||
@@ -6,7 +6,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from scripts._test_helpers import run_skill_linter
|
||||
from tests.test_helpers import run_skill_linter
|
||||
|
||||
SCRIPT = Path(__file__).resolve().parent / "check_task_type.py"
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from scripts._test_helpers import run_script
|
||||
from tests.test_helpers import run_script
|
||||
|
||||
|
||||
LINT = Path(__file__).parent / "check_v3_6_8_mark_read_commands.py"
|
||||
|
||||
@@ -4,7 +4,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from scripts._test_helpers import run_script
|
||||
from tests.test_helpers import run_script
|
||||
|
||||
SCRIPT = Path(__file__).resolve().parent / "check_v3_9_2_phase_boundary.py"
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from scripts._test_helpers import run_script
|
||||
from tests.test_helpers import run_script
|
||||
|
||||
SCRIPT = Path(__file__).resolve().parent / "check_version_consistency.py"
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from scripts._test_helpers import (
|
||||
from tests.test_helpers import (
|
||||
build_schema_validator,
|
||||
load_json_schema,
|
||||
run_script,
|
||||
|
||||
@@ -3,7 +3,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from scripts._test_helpers import run_script
|
||||
from tests.test_helpers import run_script
|
||||
|
||||
SCRIPT = Path(__file__).resolve().parent / "validate_compliance_fixtures.py"
|
||||
REAL_FIXTURES = Path(__file__).resolve().parent.parent / "examples" / "compliance"
|
||||
|
||||
@@ -6,7 +6,7 @@ from pathlib import Path
|
||||
import jsonschema
|
||||
import pytest
|
||||
|
||||
from scripts._test_helpers import load_json_schema
|
||||
from tests.test_helpers import load_json_schema
|
||||
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
"""Shared test package for ARS pytest helpers."""
|
||||
Reference in New Issue
Block a user