testsAndMisc/python_pkg/lichess_bot/tests/conftest.py

23 lines
701 B
Python
Raw Normal View History

2025-08-22 16:49:30 +02:00
import os
2025-08-23 20:27:32 +02:00
from pathlib import Path
import sys
2025-08-22 16:49:30 +02:00
import pytest
# 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
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.
"""
basename = collection_path.name
return bool(
basename.startswith("test_blunders_") and basename != "test_blunders_all.py"
)