Skip to content

Commit

Permalink
Improve type annotation of DiscoverRunner. (#1069)
Browse files Browse the repository at this point in the history
The return type of DiscoverRunner.get_resultclass should
be Optional[Type[TextTestResult]] given that it may also return PDBDebugResult:
https://github.com/django/django/blob/0dd29209091280ccf34e07c9468746c396b7778e/django/test/runner.py#L958-L962

`DicoverRunner.run_tests` accepts `None` for `extra_tests` because
that's already the default value for it:
https://github.com/django/django/blob/0dd29209091280ccf34e07c9468746c396b7778e/django/test/runner.py#L1030
  • Loading branch information
PIG208 committed Jul 22, 2022
1 parent 62c09c0 commit 563e947
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions django-stubs/test/runner.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ class DiscoverRunner:
self, test_labels: Sequence[str] = ..., extra_tests: Optional[List[Any]] = ..., **kwargs: Any
) -> TestSuite: ...
def setup_databases(self, **kwargs: Any) -> List[Tuple[BaseDatabaseWrapper, str, bool]]: ...
def get_resultclass(self) -> Optional[Type[DebugSQLTextTestResult]]: ...
def get_resultclass(self) -> Optional[Type[TextTestResult]]: ...
def get_test_runner_kwargs(self) -> Dict[str, Optional[int]]: ...
def run_checks(self, databases: Set[str]) -> None: ...
def run_suite(self, suite: TestSuite, **kwargs: Any) -> TextTestResult: ...
def teardown_databases(self, old_config: List[Tuple[BaseDatabaseWrapper, str, bool]], **kwargs: Any) -> None: ...
def teardown_test_environment(self, **kwargs: Any) -> None: ...
def suite_result(self, suite: TestSuite, result: TextTestResult, **kwargs: Any) -> int: ...
def get_databases(self, suite: TestSuite) -> Set[str]: ...
def run_tests(self, test_labels: List[str], extra_tests: List[Any] = ..., **kwargs: Any) -> int: ...
def run_tests(self, test_labels: List[str], extra_tests: Optional[List[Any]] = ..., **kwargs: Any) -> int: ...

def is_discoverable(label: str) -> bool: ...
def reorder_suite(
Expand Down

0 comments on commit 563e947

Please sign in to comment.