Improve type annotation of DiscoverRunner. (#1069)

The return type of DiscoverRunner.get_resultclass should
be Optional[Type[TextTestResult]] given that it may also return PDBDebugResult:
0dd2920909/django/test/runner.py (L958-L962)

`DicoverRunner.run_tests` accepts `None` for `extra_tests` because
that's already the default value for it:
0dd2920909/django/test/runner.py (L1030)
This commit is contained in:
PIG208
2022-07-22 03:34:26 -04:00
committed by GitHub
parent 62c09c064c
commit 563e947402

View File

@@ -122,7 +122,7 @@ class DiscoverRunner:
self, test_labels: Sequence[str] = ..., extra_tests: Optional[List[Any]] = ..., **kwargs: Any self, test_labels: Sequence[str] = ..., extra_tests: Optional[List[Any]] = ..., **kwargs: Any
) -> TestSuite: ... ) -> TestSuite: ...
def setup_databases(self, **kwargs: Any) -> List[Tuple[BaseDatabaseWrapper, str, bool]]: ... 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 get_test_runner_kwargs(self) -> Dict[str, Optional[int]]: ...
def run_checks(self, databases: Set[str]) -> None: ... def run_checks(self, databases: Set[str]) -> None: ...
def run_suite(self, suite: TestSuite, **kwargs: Any) -> TextTestResult: ... def run_suite(self, suite: TestSuite, **kwargs: Any) -> TextTestResult: ...
@@ -130,7 +130,7 @@ class DiscoverRunner:
def teardown_test_environment(self, **kwargs: Any) -> None: ... def teardown_test_environment(self, **kwargs: Any) -> None: ...
def suite_result(self, suite: TestSuite, result: TextTestResult, **kwargs: Any) -> int: ... def suite_result(self, suite: TestSuite, result: TextTestResult, **kwargs: Any) -> int: ...
def get_databases(self, suite: TestSuite) -> Set[str]: ... 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 is_discoverable(label: str) -> bool: ...
def reorder_suite( def reorder_suite(