2025-08-22 16:49:30 +02:00
|
|
|
import os
|
2025-08-23 20:27:32 +02:00
|
|
|
from pathlib import Path
|
2025-11-30 13:42:16 +01:00
|
|
|
import sys
|
2025-08-22 16:49:30 +02:00
|
|
|
|
2025-11-30 15:49:40 +01:00
|
|
|
import pytest
|
|
|
|
|
|
2025-11-30 21:20:17 +01:00
|
|
|
# Add repository root to sys.path so 'import python_pkg.*' works when running
|
2025-08-22 16:49:30 +02:00
|
|
|
# pytest with a subdirectory as rootdir.
|
|
|
|
|
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../.."))
|
|
|
|
|
if ROOT not in sys.path:
|
|
|
|
|
sys.path.insert(0, ROOT)
|
2025-08-23 20:27:32 +02:00
|
|
|
|
|
|
|
|
|
2025-11-30 21:59:24 +01:00
|
|
|
def pytest_ignore_collect(collection_path: Path, config: pytest.Config) -> bool | None:
|
2025-08-23 20:27:32 +02:00
|
|
|
"""Ignore per-game blunder test files; keep only the unified one.
|
|
|
|
|
|
|
|
|
|
This lets us keep historical files in the repo without collecting them.
|
2025-11-30 21:59:24 +01:00
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
collection_path: Path being collected.
|
|
|
|
|
config: Pytest config object (unused).
|
2025-08-23 20:27:32 +02:00
|
|
|
"""
|
2025-11-30 21:59:24 +01:00
|
|
|
del config # unused
|
2025-08-23 20:27:32 +02:00
|
|
|
basename = collection_path.name
|
2025-11-30 14:25:35 +01:00
|
|
|
return bool(
|
|
|
|
|
basename.startswith("test_blunders_") and basename != "test_blunders_all.py"
|
|
|
|
|
)
|