testsAndMisc/python_pkg/lichess_bot/tests/conftest.py
Krzysztof kuhy Rudnicki d22619b483 fix(lint): convert os.path to pathlib - remove PTH per-file ignores
- Converted os.path patterns to pathlib.Path in 15+ files
- os.path.join → Path /
- os.path.dirname → Path.parent
- os.path.exists → Path.exists()
- os.path.isfile → Path.is_file()
- os.path.abspath → Path.resolve()
- os.mkdir → Path.mkdir()
- os.listdir → Path.iterdir()
- os.getcwd → Path.cwd()
- os.replace → Path.replace()
- Updated function type hints to accept str | Path

Added PTH123 (open() vs Path.open()) to global ignores as stylistic preference
2025-11-30 23:03:03 +01:00

27 lines
809 B
Python

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 = str(Path(__file__).resolve().parent.parent.parent.parent)
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"
)