From 73380fc62387a6d3fe9f72736451e3e3aaadf4b9 Mon Sep 17 00:00:00 2001 From: hiltonlima <116589806+hiltonlima@users.noreply.github.com> Date: Thu, 7 Nov 2024 09:49:01 -0300 Subject: [PATCH] Revert "[FIX] Intermittent Tests Start Error With No Information (#157)" (#166) This reverts commit 316a934d45d94f177c3525d3d9cd8b6718e81014. --- .../support/python_testing/models/test_case.py | 10 ++++++++-- .../matter/sdk_tests/support/sdk_container.py | 13 ------------- .../support/tests/test_sdk_container.py | 16 ---------------- 3 files changed, 8 insertions(+), 31 deletions(-) diff --git a/test_collections/matter/sdk_tests/support/python_testing/models/test_case.py b/test_collections/matter/sdk_tests/support/python_testing/models/test_case.py index 98e750e4..b2486f03 100644 --- a/test_collections/matter/sdk_tests/support/python_testing/models/test_case.py +++ b/test_collections/matter/sdk_tests/support/python_testing/models/test_case.py @@ -17,6 +17,7 @@ from asyncio import sleep from enum import IntEnum from inspect import iscoroutinefunction +from multiprocessing.managers import BaseManager from pathlib import Path from socket import SocketIO from typing import Any, Optional, Type, TypeVar @@ -37,7 +38,10 @@ from ...sdk_container import SDKContainer from ...utils import prompt_for_commissioning_mode from .python_test_models import PythonTest, PythonTestType -from .python_testing_hooks_proxy import SDKPythonTestResultBase +from .python_testing_hooks_proxy import ( + SDKPythonTestResultBase, + SDKPythonTestRunnerHooks, +) from .utils import ( EXECUTABLE, RUNNER_CLASS_PATH, @@ -257,7 +261,9 @@ async def execute(self) -> None: try: logger.info("Running Python Test: " + self.python_test.name) - manager = self.sdk_container.manager + BaseManager.register("TestRunnerHooks", SDKPythonTestRunnerHooks) + manager = BaseManager(address=("0.0.0.0", 50000), authkey=b"abc") + manager.start() test_runner_hooks = manager.TestRunnerHooks() # type: ignore if not self.python_test.path: diff --git a/test_collections/matter/sdk_tests/support/sdk_container.py b/test_collections/matter/sdk_tests/support/sdk_container.py index aed69d5c..d059ce3b 100644 --- a/test_collections/matter/sdk_tests/support/sdk_container.py +++ b/test_collections/matter/sdk_tests/support/sdk_container.py @@ -15,7 +15,6 @@ # from __future__ import annotations -from multiprocessing.managers import BaseManager from pathlib import Path from typing import Optional, Union @@ -30,7 +29,6 @@ from .exec_run_in_container import ExecResultExtended, exec_run_in_container from .pics import set_pics_command -from .python_testing.models.python_testing_hooks_proxy import SDKPythonTestRunnerHooks # Trace mount LOCAL_LOGS_PATH = Path("/var/tmp") @@ -136,7 +134,6 @@ def __init__( self.__pics_file_created = False self.logger = logger - self.manager: BaseManager | None = None @property def pics_file_created(self) -> bool: @@ -151,13 +148,6 @@ def __destroy_existing_container(self) -> None: ) container_manager.destroy(existing_container) - def __create_manager(self) -> BaseManager: - BaseManager.register("TestRunnerHooks", SDKPythonTestRunnerHooks) - manager = BaseManager(address=("0.0.0.0", 50000), authkey=b"abc") - manager.start() - - return manager - def is_running(self) -> bool: if self.__container is None: return False @@ -184,9 +174,6 @@ async def start(self) -> None: self.image_tag, self.run_parameters ) - # Create the BaseManager for multiprocess data share - self.manager = self.__create_manager() - self.logger.info( f"{self.container_name} container started" f" with configuration: {self.run_parameters}" diff --git a/test_collections/matter/sdk_tests/support/tests/test_sdk_container.py b/test_collections/matter/sdk_tests/support/tests/test_sdk_container.py index e5577d84..abe7a897 100644 --- a/test_collections/matter/sdk_tests/support/tests/test_sdk_container.py +++ b/test_collections/matter/sdk_tests/support/tests/test_sdk_container.py @@ -76,10 +76,6 @@ async def test_destroy_container_running() -> None: with mock.patch.object( target=sdk_container, attribute="is_running", return_value=False - ), mock.patch.object( - target=sdk_container, - attribute="_SDKContainer__create_manager", - return_value=None, ), mock.patch.object( target=container_manager, attribute="get_container", return_value=None ), mock.patch.object( @@ -116,10 +112,6 @@ async def test_destroy_container_once() -> None: with mock.patch.object( target=sdk_container, attribute="is_running", return_value=False - ), mock.patch.object( - target=sdk_container, - attribute="_SDKContainer__create_manager", - return_value=None, ), mock.patch.object( target=container_manager, attribute="get_container", return_value=None ), mock.patch.object( @@ -155,10 +147,6 @@ async def test_send_command_default_prefix() -> None: with mock.patch.object( target=sdk_container, attribute="is_running", return_value=False - ), mock.patch.object( - target=sdk_container, - attribute="_SDKContainer__create_manager", - return_value=None, ), mock.patch.object( target=container_manager, attribute="get_container", return_value=None ), mock.patch.object( @@ -200,10 +188,6 @@ async def test_send_command_custom_prefix() -> None: with mock.patch.object( target=sdk_container, attribute="is_running", return_value=False - ), mock.patch.object( - target=sdk_container, - attribute="_SDKContainer__create_manager", - return_value=None, ), mock.patch.object( target=container_manager, attribute="get_container", return_value=None ), mock.patch.object(