Skip to content

Update django.test.runner stubs #1888

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

UnknownPlatypus
Copy link
Contributor

Removes 25 entries form the todolist.

I moved RemovedInDjangoXX allowlist entries at the bottom of the allowlist.txt so it's easier to find/update them.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

) -> Iterator[TestCase]: ...
def reorder_tests(
tests: list[TestCase], classes: tuple[type[TestCase], ...], reverse: bool = ..., shuffler: Shuffler | None = ...
) -> Iterator[TestCase]: ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use Iterator here and Generator in iter_test_cases? They should be similar

@@ -159,12 +182,23 @@ class DiscoverRunner:
def get_databases(self, suite: TestSuite) -> set[str]: ...
def run_tests(self, test_labels: list[str], extra_tests: list[Any] | None = ..., **kwargs: Any) -> int: ...

def is_discoverable(label: str) -> bool: ...
def try_importing(label: str) -> bool: ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


class DiscoverRunner:
test_suite: type[TestSuite]
parallel_test_suite: type[ParallelTestSuite]
test_runner: type[TextTestRunner]
test_loader: TestLoader
reorder_by: tuple[SimpleTestCase, ...]
reorder_by: tuple[type[TestCase], type[SimpleTestCase]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it should be tuple[type[X], ...], where X is a proper type name.

Why? Because it would be easier to subclass and change. Or maybe even Iterable / Sequence.


class ParallelTestSuite(TestSuite):
init_worker: Any
process_setup: Callable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we type it better?


class RemoteTestResult:
events: list[Any]
failfast: bool
shouldStop: bool
testsRun: int
def __init__(self) -> None: ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a TODO entry to sync this signature with unittest.TestResult?

@intgr
Copy link
Collaborator

intgr commented Mar 25, 2024

Assigned to @sobolevn. If you don't want to lead the review here, feel free to unassign yourself.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants