From ee6031f938830a9ba73277b17c09a32bb766c3cd Mon Sep 17 00:00:00 2001 From: James Swan <122404367+swan-amazon@users.noreply.github.com> Date: Tue, 27 Aug 2024 21:51:46 +0000 Subject: [PATCH] fixup --- src/python_testing/matter_testing_support.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/python_testing/matter_testing_support.py b/src/python_testing/matter_testing_support.py index 02b3bf856a53e8..f0878c5dbde00b 100644 --- a/src/python_testing/matter_testing_support.py +++ b/src/python_testing/matter_testing_support.py @@ -520,10 +520,14 @@ def test_skipped(self, filename: str, name: str): @dataclass class MatterTestConfig: - def merge(self, override_attr_dict: dict): - for key, value in override_attr_dict.items(): - setattr(self, key, value) - return self + def update(self, override_attr_dict: dict) -> None: + """ + Update the attributes of the MatterTestConfig instance with the values provided in the override_attr_dict. + + This method allows for dynamic modification of the instance's attributes. If a key in override_attr_dict matches an existing attribute name, the attribute's value is updated. If the key does not match any existing attribute, a new attribute is created with the given key and value. + """ + self.__dict__.update(override_attr_dict) + storage_path: pathlib.Path = pathlib.Path(".") logs_path: pathlib.Path = pathlib.Path(".") @@ -2141,7 +2145,7 @@ def default_matter_test_main(override_matter_test_config: dict = {}): matter_test_config: MatterTestConfig = parse_matter_test_args() # Apply test configuration overrides - matter_test_config.merge(override_matter_test_config) + matter_test_config.update(override_matter_test_config) # Find the test class in the test script. test_class = _find_test_class()