From 0d959776b205c760520e513aae8333e306b28555 Mon Sep 17 00:00:00 2001 From: Nick Pope Date: Thu, 14 Mar 2024 07:05:09 +0000 Subject: [PATCH] 5.0: Update `django.test` (#2005) --- django-stubs/test/client.pyi | 85 ++++++++++++++++++++ django-stubs/test/runner.pyi | 2 + scripts/stubtest/allowlist_todo_django50.txt | 18 ----- 3 files changed, 87 insertions(+), 18 deletions(-) diff --git a/django-stubs/test/client.pyi b/django-stubs/test/client.pyi index 66f9a41b4..e15e2b58a 100644 --- a/django-stubs/test/client.pyi +++ b/django-stubs/test/client.pyi @@ -311,3 +311,88 @@ class AsyncClient(ClientMixin, _AsyncRequestFactory[Awaitable[_MonkeyPatchedASGI **defaults: Any, ) -> None: ... async def request(self, **request: Any) -> _MonkeyPatchedASGIResponse: ... + async def get( # type: ignore[override] + self, + path: str, + data: _GetDataType = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedASGIResponse: ... + async def post( # type: ignore[override] + self, + path: str, + data: Any = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedASGIResponse: ... + async def head( # type: ignore[override] + self, + path: str, + data: Any = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedASGIResponse: ... + async def options( # type: ignore[override] + self, + path: str, + data: dict[str, str] | str = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedASGIResponse: ... + async def put( # type: ignore[override] + self, + path: str, + data: Any = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedASGIResponse: ... + async def patch( # type: ignore[override] + self, + path: str, + data: Any = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedASGIResponse: ... + async def delete( # type: ignore[override] + self, + path: str, + data: Any = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedASGIResponse: ... + async def trace( # type: ignore[override] + self, + path: str, + data: Any = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedASGIResponse: ... diff --git a/django-stubs/test/runner.pyi b/django-stubs/test/runner.pyi index 1424eaca5..269cd55df 100644 --- a/django-stubs/test/runner.pyi +++ b/django-stubs/test/runner.pyi @@ -55,6 +55,7 @@ class RemoteTestResult: def stopTestRun(self) -> None: ... def startTest(self, test: Any) -> None: ... def stopTest(self, test: Any) -> None: ... + def addDuration(self, test: Any, elapsed: Any) -> None: ... def addError(self, test: Any, err: Any) -> None: ... def addFailure(self, test: Any, err: Any) -> None: ... def addSubTest(self, test: Any, subtest: Any, err: Any) -> None: ... @@ -132,6 +133,7 @@ class DiscoverRunner: timing: bool = ..., shuffle: int | Literal[False] = ..., logger: logging.Logger | None = ..., + durations: int | None = ..., **kwargs: Any, ) -> None: ... @classmethod diff --git a/scripts/stubtest/allowlist_todo_django50.txt b/scripts/stubtest/allowlist_todo_django50.txt index b790f677b..ba22984c1 100644 --- a/scripts/stubtest/allowlist_todo_django50.txt +++ b/scripts/stubtest/allowlist_todo_django50.txt @@ -222,24 +222,6 @@ django.template.Template.__iter__ django.template.autoreload django.template.base.Template.__iter__ django.template.defaultfilters.escapeseq -django.test.AsyncClient.delete -django.test.AsyncClient.get -django.test.AsyncClient.head -django.test.AsyncClient.options -django.test.AsyncClient.patch -django.test.AsyncClient.post -django.test.AsyncClient.put -django.test.AsyncClient.trace -django.test.client.AsyncClient.delete -django.test.client.AsyncClient.get -django.test.client.AsyncClient.head -django.test.client.AsyncClient.options -django.test.client.AsyncClient.patch -django.test.client.AsyncClient.post -django.test.client.AsyncClient.put -django.test.client.AsyncClient.trace -django.test.runner.DiscoverRunner.__init__ -django.test.runner.RemoteTestResult.addDuration django.utils.choices django.utils.deprecation.RemovedInDjango50Warning django.utils.deprecation.RemovedInDjango60Warning