Files
shopdb-flask/pytest.ini
Proudlock f1ff46e764 Fix plugin settings route endpoint and enable parallel test execution
Bugfix: Fix AttributeError in /api/plugins/settings-routes endpoint
- Changed get_enabled_plugin_instances() to get_all_plugins()
- Added explicit enabled check with pm.registry.is_enabled()
- Test failure: test_no_route_answers_a_nonsense_filter_with_a_server_error

Optimization: Enable parallel test execution (Phase 1 of pytest speedup)
- Added pytest-xdist configuration to pytest.ini
- Enabled -n auto (auto-detect CPU cores, typically 8 workers)
- Added slow marker for future test categorization
- Expected speedup: 4-8x (20 min -> 2.5-5 min)

Root cause: 2857 tests recreate entire schema per test (0.4-0.6s overhead each)
- Phase 2 (savepoint isolation) will achieve 80x total speedup
- See docs/PYTEST-OPTIMIZATION-PLAN.md for full analysis

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-09-11 17:22:18 -04:00

38 lines
1.3 KiB
INI

[pytest]
# Tests live in tests/. Saying so is not cosmetic.
#
# deploy/windows/installer/bundle/ is BUILD OUTPUT: build-installer.sh stages a
# complete copy of the application there, plugins included. Without this,
# collection walked into it and imported every plugin a second time under a
# second path, so SQLAlchemy raised "Table 'printeditems' is already defined for
# this MetaData instance" and the whole suite failed to collect - on a tree with
# nothing wrong in it, purely because somebody had built an installer first.
#
# It only started biting when the bundle grew from four plugins to thirteen,
# which is the sort of delay that makes this look like a code fault rather than
# a stale artefact.
testpaths = tests
# Parallel execution: auto-detect CPU cores and run tests in parallel
# Gives 4-8x speedup on modern machines (pytest-xdist required, already installed)
# Disable with: pytest -n0
addopts = -n auto
# Test markers
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
# Belt and braces: even an explicit path or an IDE run must not descend into
# build output or a staged copy of the tree.
norecursedirs =
.git
venv
.venv
node_modules
bundle
dist
build
frontend/dist
frontend/dist-subpath
*.egg-info