From 1a74714b2a61ecc22240f5841fb1bb73627b63d6 Mon Sep 17 00:00:00 2001 From: Tibor Reiss Date: Tue, 22 Oct 2024 20:43:28 +0200 Subject: [PATCH] Remove init due to breaking change in pytest 8.2.0 --- mmengine/testing/_internal/distributed.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mmengine/testing/_internal/distributed.py b/mmengine/testing/_internal/distributed.py index b795cc9456..2e1d8952e5 100644 --- a/mmengine/testing/_internal/distributed.py +++ b/mmengine/testing/_internal/distributed.py @@ -88,16 +88,15 @@ def wrapper(self): return types.MethodType(wrapper, self) - # The main process spawns N subprocesses that run the test. - # Constructor patches current instance test method to - # assume the role of the main process and join its subprocesses, - # or run the underlying test function. - def __init__(self, method_name: str = 'runTest') -> None: - super().__init__(method_name) + def setUp(self) -> None: + # The main process spawns N subprocesses that run the test. + # This patches current instance test method to + # assume the role of the main process and join its subprocesses, + # or run the underlying test function. + method_name = self._testMethodName fn = getattr(self, method_name) setattr(self, method_name, self.join_or_run(fn)) - def setUp(self) -> None: super().setUp() self.skip_return_code_checks = [] # type: ignore[var-annotated] self.processes = [] # type: ignore[var-annotated]