From c581dc485064e6160d281ca4f2c037b9357b7a70 Mon Sep 17 00:00:00 2001 From: Artur Shiriev Date: Fri, 26 Jun 2026 20:51:02 +0300 Subject: [PATCH] test: lock in instance-attribute reads in api_bootstrapper_config Port the regression test from litestar-sqlalchemy-template#32. The production bug fixed there (api_bootstrapper_config reading the module -global `settings` singleton instead of `self`) is already absent here, but there was no test guarding against it being reintroduced. The test constructs a non-singleton Settings instance and asserts its api_bootstrapper_config reflects that instance, not the global. Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/test_settings.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/test_settings.py diff --git a/tests/test_settings.py b/tests/test_settings.py new file mode 100644 index 0000000..48949de --- /dev/null +++ b/tests/test_settings.py @@ -0,0 +1,10 @@ +from app.settings import Settings + + +def test_api_bootstrapper_config_reads_instance_not_global() -> None: + custom = Settings(service_name="custom-service", service_version="9.9.9") + + config = custom.api_bootstrapper_config + + assert config.service_name == "custom-service" + assert config.service_version == "9.9.9"