Adds autouse fixture _reset_webhook_secrets to tests/conftest.py that resets the process-wide Pydantic settings singleton before every test: 1. gitea_webhook_secret / plane_webhook_secret → "" (HMAC disabled by default). Tests that deliberately test the 401 path (test_webhook_dedup.py:268,278) override this with their own monkeypatch which runs after autouse fixtures and wins for that test only. 2. db_path → os.environ["ORCH_DB_PATH"] (last written value after all test modules are imported). Without this, test_webhook_dedup.py (imported first alphabetically) seeds settings.db_path = dedup.db, while test_webhooks.py setup_db tries to remove test_orchestrator.db — leaving the DB dirty between tests that share a branch name and causing get_task_by_repo_branch() to return a stale row with the wrong stage. Per-test monkeypatches in test_webhook_dedup.setup_db still override it. Root cause: both leaks come from the same singleton settings being read once at import, before any per-test isolation runs. The autouse fixture is the correct per-test reset point for process-wide singletons. Result: pytest tests/ → 294 passed, 0 failed (was 10 failed/284 passed).
3.6 KiB
3.6 KiB