We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c9b5996 commit fcc90c8Copy full SHA for fcc90c8
mmengine/testing/_internal/distributed.py
@@ -94,8 +94,14 @@ def wrapper(self):
94
# or run the underlying test function.
95
def __init__(self, method_name: str = 'runTest') -> None:
96
super().__init__(method_name)
97
- fn = getattr(self, method_name)
98
- setattr(self, method_name, self.join_or_run(fn))
+ try:
+ fn = getattr(self, method_name)
99
+ setattr(self, method_name, self.join_or_run(fn))
100
+ except AttributeError as e:
101
+ if method_name != 'runTest':
102
+ # we allow instantiation with no explicit method name
103
+ # but not an *incorrect* or missing method name
104
+ raise ValueError(f"no such test method in {self.__class__}: {method_name}") from e
105
106
def setUp(self) -> None:
107
super().setUp()
0 commit comments