Skip to content

Commit

Permalink
Revert "[FIX] Intermittent Tests Start Error With No Information (#157)…
Browse files Browse the repository at this point in the history
…" (#166)

This reverts commit 316a934.
  • Loading branch information
hiltonlima authored Nov 7, 2024
1 parent 9b841b9 commit 73380fc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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:
Expand Down
13 changes: 0 additions & 13 deletions test_collections/matter/sdk_tests/support/sdk_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#
from __future__ import annotations

from multiprocessing.managers import BaseManager
from pathlib import Path
from typing import Optional, Union

Expand All @@ -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")
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 73380fc

Please sign in to comment.