From e76ced917e083289ff1c92e49cf0c78fba7262c6 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 21 Oct 2025 12:46:49 -0500 Subject: [PATCH] test: make DataTestCase inherit from ConfigTestCase just some housekeeping --- src/wuttjamaican/testing.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/wuttjamaican/testing.py b/src/wuttjamaican/testing.py index 8efda7b..2461674 100644 --- a/src/wuttjamaican/testing.py +++ b/src/wuttjamaican/testing.py @@ -179,8 +179,7 @@ class ConfigTestCase(FileTestCase): return WuttaConfig(**kwargs) -# TODO: this should inherit from ConfigTestCase -class DataTestCase(FileTestCase): +class DataTestCase(ConfigTestCase): """ Base class for test suites requiring a full (typical) database. @@ -220,15 +219,8 @@ class DataTestCase(FileTestCase): """ Perform config/app/db setup operations for the test. """ - self.setup_files() - self.config = self.make_config( - defaults={ - "wutta.db.default.url": "sqlite://", - } - ) - self.app = self.config.get_app() + self.setup_config() - # init db model = self.app.model model.Base.metadata.create_all(bind=self.config.appdb_engine) self.session = self.app.make_session() @@ -241,8 +233,10 @@ class DataTestCase(FileTestCase): """ Perform config/app/db teardown operations for the test. """ - self.teardown_files() + self.teardown_config() def make_config(self, **kwargs): # pylint: disable=empty-docstring """ """ - return WuttaConfig(**kwargs) + defaults = kwargs.setdefault("defaults", {}) + defaults.setdefault("wutta.db.default.url", "sqlite://") + return super().make_config(**kwargs)