From 5d1604c7455669c64b743e952187f1604db3794f Mon Sep 17 00:00:00 2001 From: James Knight Date: Sat, 18 Nov 2023 10:13:55 -0500 Subject: [PATCH] tests: always clone configuration to support decorator config overrides When decorators are used to alter the test case's configuration, this is applied to a base configuration prepared for the entire test class. This could then result in some unit tests changing other unit test's configuration, depending on how the unit test order is run. To prevent unexpected configuration changes, always clone the base configuration when running a prepare/build invoke. Signed-off-by: James Knight --- tests/lib/testcase.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/lib/testcase.py b/tests/lib/testcase.py index c3f8923c..8845a01a 100644 --- a/tests/lib/testcase.py +++ b/tests/lib/testcase.py @@ -61,7 +61,7 @@ def build(self, *args, **kwargs): new_kwargs = dict(kwargs) new_kwargs.setdefault('builder', self.builder) - new_kwargs.setdefault('config', self.config) + new_kwargs.setdefault('config', self.config.clone()) if self.target_editor: new_kwargs['config']['confluence_editor'] = self.target_editor @@ -78,7 +78,7 @@ def prepare(self, *args, **kwargs): new_kwargs = dict(kwargs) new_kwargs.setdefault('builder', self.builder) - new_kwargs.setdefault('config', self.config) + new_kwargs.setdefault('config', self.config.clone()) if self.target_editor: new_kwargs['config']['confluence_editor'] = self.target_editor