refactor(tests): reorganize tests per module with shared root conftest

Move 42 single-module test files into app/modules/*/tests/ directories
while keeping 40 cross-module and infrastructure tests central in tests/.
Hub fixtures (engine, db, client, cleanup) moved to root conftest.py so
both tests/ and module tests inherit them. Update pyproject.toml testpaths
and Makefile TEST_PATHS to discover all test locations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-10 21:42:06 +01:00
parent 1da03e41f9
commit ecb5309879
34 changed files with 228 additions and 183 deletions

View File

@@ -66,6 +66,7 @@ unfixable = []
"models/database/base.py" = ["F401"]
# Ignore specific rules in test files
"tests/**/*.py" = ["S101", "PLR2004"]
"app/modules/*/tests/**/*.py" = ["S101", "PLR2004"]
# Alembic migrations can have longer lines and specific patterns
"alembic/versions/*.py" = ["E501", "F401"]
@@ -113,7 +114,18 @@ ignore_errors = true
# =============================================================================
[tool.pytest.ini_options]
minversion = "7.0"
testpaths = ["tests"]
testpaths = [
"tests",
"app/modules/tenancy/tests",
"app/modules/catalog/tests",
"app/modules/billing/tests",
"app/modules/messaging/tests",
"app/modules/orders/tests",
"app/modules/customers/tests",
"app/modules/marketplace/tests",
"app/modules/inventory/tests",
"app/modules/loyalty/tests",
]
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]