From 2d5539073392ae799606447bbd0a44a37a1fa078 Mon Sep 17 00:00:00 2001 From: Tibor Reiss Date: Wed, 23 Oct 2024 22:37:04 +0200 Subject: [PATCH] Do not skip if exited properly --- mmengine/testing/_internal/distributed.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mmengine/testing/_internal/distributed.py b/mmengine/testing/_internal/distributed.py index 0d602a3964..5f3dffa810 100644 --- a/mmengine/testing/_internal/distributed.py +++ b/mmengine/testing/_internal/distributed.py @@ -101,7 +101,8 @@ def __init__(self, method_name: str = 'runTest') -> None: if method_name != 'runTest': # we allow instantiation with no explicit method name # but not an *incorrect* or missing method name - raise ValueError(f"no such test method in {self.__class__}: {method_name}") from e + raise ValueError(f'no such test method in {self.__class__}:' + f' {method_name}') from e def setUp(self) -> None: super().setUp() @@ -351,12 +352,13 @@ def _check_return_codes(self, elapsed_time) -> None: if first_process.exitcode == skip.exit_code: raise unittest.SkipTest(skip.message) - # Skip the unittest since the raised error maybe not caused by - # the tested function. For example, in CI environment, the tested - # method could be terminated by system signal for the limited - # resources. - self.skipTest(f'Skip test {self._testMethodName} due to ' - 'the program abort') + if first_process.exitcode != 0: + # Skip the unittest since the raised error maybe not caused by + # the tested function. For example, in CI environment, the tested + # method could be terminated by system signal for the limited + # resources. + self.skipTest(f'Skip test {self._testMethodName} due to ' + 'the program abort') @property def is_master(self) -> bool: