From 94c6562f8211ebe90576c96e4cc1e37a7bce70dd Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Wed, 14 Dec 2022 20:01:06 +0100 Subject: [PATCH] Tests: make sure DB overwrite actually takes --- WebHost.py | 2 +- test/webhost/TestAPIGenerate.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/WebHost.py b/WebHost.py index ce8443db..d098f6e7 100644 --- a/WebHost.py +++ b/WebHost.py @@ -29,7 +29,7 @@ if not os.path.exists(configpath): # fall back to config.yaml in home def get_app(): register() app = raw_app - if os.path.exists(configpath): + if os.path.exists(configpath) and not app.config["TESTING"]: import yaml app.config.from_file(configpath, yaml.safe_load) logging.info(f"Updated config from {configpath}") diff --git a/test/webhost/TestAPIGenerate.py b/test/webhost/TestAPIGenerate.py index e50bf96e..5c14373a 100644 --- a/test/webhost/TestAPIGenerate.py +++ b/test/webhost/TestAPIGenerate.py @@ -11,10 +11,11 @@ class TestDocs(unittest.TestCase): "filename": ":memory:", "create_db": True, } - app = get_app() - app.config.update({ + raw_app.config.update({ "TESTING": True, }) + app = get_app() + cls.client = app.test_client() def testCorrectErrorEmptyRequest(self):