From 4ba50aa218e0023012eb84ac638de0478e38d0cc Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 9 May 2023 21:19:39 -0400 Subject: [PATCH] Fix matter_yamltests with Python 11 again. Due to https://docs.python.org/3.11/whatsnew/3.11.html#dataclasses, the previous code fails: it's using a mutable class instance as a default values of a dataclass field. --- scripts/py_matter_yamltests/matter_yamltests/runner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/py_matter_yamltests/matter_yamltests/runner.py b/scripts/py_matter_yamltests/matter_yamltests/runner.py index 3229dace1301bf..fe4a091bc9676f 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/runner.py +++ b/scripts/py_matter_yamltests/matter_yamltests/runner.py @@ -16,7 +16,7 @@ import asyncio import time from abc import ABC, abstractmethod -from dataclasses import dataclass +from dataclasses import dataclass, field from .adapter import TestAdapter from .hooks import TestRunnerHooks @@ -72,7 +72,7 @@ class TestRunnerConfig: """ adapter: TestAdapter = None pseudo_clusters: PseudoClusters = PseudoClusters([]) - options: TestRunnerOptions = TestRunnerOptions() + options: TestRunnerOptions = field(default_factory=TestRunnerOptions) hooks: TestRunnerHooks = TestRunnerHooks()