From aefb129e072814d0eb5c3b5b8c6d9d2ecb66fa9d Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Sun, 15 Mar 2026 14:14:08 +0100 Subject: [PATCH] chore: add test infrastructure with conftest for import paths Co-Authored-By: Claude Sonnet 4.6 --- pytest.ini | 2 ++ tests/__init__.py | 0 tests/conftest.py | 9 +++++++++ 3 files changed, 11 insertions(+) create mode 100644 pytest.ini create mode 100644 tests/__init__.py create mode 100644 tests/conftest.py diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..5ee6477 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +testpaths = tests diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..9ceb81b --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,9 @@ +"""Test configuration — adds package root to sys.path so bare imports work.""" +import sys +from pathlib import Path + +# Add the package root so `from stats_db import StatsDB` works in tests +# without requiring the full package to be installed. +_PACKAGE_ROOT = Path(__file__).resolve().parent.parent +if str(_PACKAGE_ROOT) not in sys.path: + sys.path.insert(0, str(_PACKAGE_ROOT))