From e969d2548d9d5d6d836a7c1a642ffede64c31c45 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 10 May 2023 13:42:47 -0400 Subject: [PATCH] Fix matter_yamltests with Python 11 again. (#26464) 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()