mirror of
https://github.com/kuhyx/testsAndMisc-archive.git
synced 2026-07-04 18:03:11 +02:00
- 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
28 lines
830 B
Python
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"
|
|
)
|