Skip to content

Commit 486ac88

Browse files
authored
Correct type hint on Test.execute() (#975)
The function docstring says `test_start` can be "Either a trigger phase for starting the test, or a function that returns a DUT ID.` Unfortunately, when you provide the latter, Mypy is unhappy: ``` Argument "test_start" to "execute" of "Test" has incompatible type "Callable[[], str]"; expected "Union[PhaseDescriptor, Callable[..., Optional[PhaseResult]], None]" [arg-type] ``` This commit updates the type hint of the parameter to be a Union that reflects the docstring.
1 parent 341aa86 commit 486ac88

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

openhtf/core/test_descriptor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def abort_from_sig_int(self) -> None:
275275
self._executor.abort()
276276

277277
def execute(self,
278-
test_start: Optional[phase_descriptor.PhaseT] = None,
278+
test_start: Optional[Union[phase_descriptor.PhaseT, Callable[[], str]]] = None,
279279
profile_filename: Optional[Text] = None) -> bool:
280280
"""Starts the framework and executes the given test.
281281

0 commit comments

Comments
 (0)