diff --git a/tests/test_journal_cli_migration.py b/tests/test_journal_cli_migration.py index ac3d839f3..d41eb987a 100644 --- a/tests/test_journal_cli_migration.py +++ b/tests/test_journal_cli_migration.py @@ -6,8 +6,6 @@ from __future__ import annotations import re from pathlib import Path -import pytest - from solstone.think.sol_cli import ALIASES, COMMANDS EXCLUDED_DIRS = { @@ -124,21 +122,21 @@ SERVICE_SOL_LITERAL_RE = re.compile( ) -@pytest.mark.parametrize("path", _candidate_files(), ids=str) -def test_service_tagged_commands_are_not_documented_as_sol(path: Path) -> None: - text = path.read_text(encoding="utf-8") - checked_lines = [line for line in text.splitlines() if not _skip_line(path, line)] - service_matches = [ - (line_number, line) - for line_number, line in enumerate(checked_lines, start=1) - if SERVICE_SOL_RE.search(line) - ] +def test_service_tagged_commands_are_not_documented_as_sol() -> None: + service_matches = [] + missing_access_expectations = [] + for path in _candidate_files(): + text = path.read_text(encoding="utf-8") + for line_number, line in enumerate(text.splitlines(), start=1): + if not _skip_line(path, line) and SERVICE_SOL_RE.search(line): + service_matches.append(f"{path}:{line_number}: {line}") + + access_expectation = ACCESS_POSITIVE_EXPECTATIONS.get(path) + if access_expectation is not None and access_expectation.search(text) is None: + missing_access_expectations.append(str(path)) assert service_matches == [] - - access_expectation = ACCESS_POSITIVE_EXPECTATIONS.get(path) - if access_expectation is not None: - assert access_expectation.search(text) + assert missing_access_expectations == [] def _production_python_files() -> list[Path]: diff --git a/tests/test_sol_call_redirect_sweep.py b/tests/test_sol_call_redirect_sweep.py index 3fad40419..ae2a7102b 100644 --- a/tests/test_sol_call_redirect_sweep.py +++ b/tests/test_sol_call_redirect_sweep.py @@ -7,8 +7,6 @@ import re import subprocess from pathlib import Path -import pytest - EXCLUDED_DIRS = {".git", ".venv", "build", "dist"} TEXT_SUFFIXES = { ".html", @@ -69,26 +67,29 @@ def _candidate_files() -> list[Path]: return files -@pytest.mark.parametrize("path", _candidate_files(), ids=str) -def test_old_sol_call_local_paths_are_not_documented(path: Path) -> None: - text = path.read_text(encoding="utf-8") +def test_old_sol_call_local_paths_are_not_documented() -> None: matches = [] - for line_number, line in enumerate(text.splitlines(), start=1): - for pattern in BAN_PATTERNS: - if pattern.search(line): - matches.append((line_number, line)) + for path in _candidate_files(): + text = path.read_text(encoding="utf-8") + for line_number, line in enumerate(text.splitlines(), start=1): + for pattern in BAN_PATTERNS: + if pattern.search(line): + matches.append(f"{path}:{line_number}: {line}") assert matches == [] -@pytest.mark.parametrize( - "survivor", - [ +def test_old_sol_call_ban_regex_precision() -> None: + survivors = ( "sol call settings identity", "sol call settings providers show", "sol call settings providers set-generate", "sol call settings providers set-cogitate", - ], -) -def test_old_sol_call_ban_regex_precision(survivor: str) -> None: - assert all(pattern.search(survivor) is None for pattern in BAN_PATTERNS) + ) + matches = [ + survivor + for survivor in survivors + if any(pattern.search(survivor) is not None for pattern in BAN_PATTERNS) + ] + + assert matches == []