testsAndMisc-archive/python_pkg/lichess_bot/tests/conftest.py
Krzysztof kuhy Rudnicki 2ffa1cc169 fix(lint): LOG015 - replace root logger with module loggers
- Add _logger = logging.getLogger(__name__) to all modules
- Replace logging.X() calls with _logger.X() calls
- Remove logging.basicConfig() from module level (keep in run_bot())
- Add G004 to global ignores (f-strings in logging are more readable)
- Remove LOG015 and G004 per-file ignores from pyproject.toml
- Fix pytest_ignore_collect hook signature in conftest.py
2025-11-30 21:59:24 +01:00

28 lines
830 B
Python

import os
from pathlib import Path
import sys
import pytest
# Add repository root to sys.path so 'import python_pkg.*' works when running
# 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)
def pytest_ignore_collect(collection_path: Path, config: pytest.Config) -> bool | None:
"""Ignore per-game blunder test files; keep only the unified one.
This lets us keep historical files in the repo without collecting them.
Args:
collection_path: Path being collected.
config: Pytest config object (unused).
"""
del config # unused
basename = collection_path.name
return bool(
basename.startswith("test_blunders_") and basename != "test_blunders_all.py"
)