Problem
The module-level settings = Settings() singleton in src/paperscout/config.py is instantiated at import time. Tests work around this by setting _PAPERSCOUT_TESTING=1 before import. There is no supported mechanism to temporarily override the global singleton for integration scenarios or fixture-driven parametric tests.
Acceptance Criteria
Implementation Notes
- Primary file:
src/paperscout/config.py — add override_settings() context manager
- Pattern:
contextlib.contextmanager that swaps and restores paperscout.config.settings
- Test fixture update:
tests/conftest.py — optionally refactor make_test_settings()
References
src/paperscout/config.py (settings = Settings())
tests/conftest.py (os.environ.setdefault("_PAPERSCOUT_TESTING", "1"))
Problem
The module-level
settings = Settings()singleton insrc/paperscout/config.pyis instantiated at import time. Tests work around this by setting_PAPERSCOUT_TESTING=1before import. There is no supported mechanism to temporarily override the global singleton for integration scenarios or fixture-driven parametric tests.Acceptance Criteria
override_settings(**kwargs)) temporarily replaces the module-levelsettingssingleton and restores it on exitImplementation Notes
src/paperscout/config.py— addoverride_settings()context managercontextlib.contextmanagerthat swaps and restorespaperscout.config.settingstests/conftest.py— optionally refactormake_test_settings()References
src/paperscout/config.py(settings = Settings())tests/conftest.py(os.environ.setdefault("_PAPERSCOUT_TESTING", "1"))