You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0ca325e
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -435,7 +435,7 @@ For a more complete example including more features, see the <a href="https://fa
435
435
***GraphQL** integration with [Strawberry](https://strawberry.rocks) and other libraries.
436
436
* Many extra features (thanks to Starlette) such as:
437
437
***WebSockets**
438
-
* extremely easy tests based on HTTPX and `pytest`
438
+
* extremely easy tests based on HTTPX2 and `pytest`
439
439
***CORS**
440
440
***Cookie Sessions**
441
441
* ...and more.
@@ -498,7 +498,7 @@ Used by Pydantic:
498
498
499
499
Used by Starlette:
500
500
501
-
*[`httpx`](https://www.python-httpx.org) - Required if you want to use the `TestClient`.
501
+
*[`httpx2`](https://pydantic.dev/docs/httpx2/) - Required if you want to use the `TestClient`.
502
502
*[`jinja2`](https://jinja.palletsprojects.com) - Required if you want to use the default template configuration.
503
503
*[`python-multipart`](https://github.com/Kludex/python-multipart) - Required if you want to support form <dfntitle="converting the string that comes from an HTTP request into Python data">"parsing"</dfn>, with `request.form()`.
Copy file name to clipboardExpand all lines: docs/de/docs/advanced/async-tests.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,13 +10,13 @@ Schauen wir uns an, wie wir das machen können.
10
10
11
11
Wenn wir in unseren Tests asynchrone Funktionen aufrufen möchten, müssen unsere Testfunktionen asynchron sein. AnyIO stellt hierfür ein nettes Plugin zur Verfügung, mit dem wir festlegen können, dass einige Testfunktionen asynchron aufgerufen werden sollen.
12
12
13
-
## HTTPX { #httpx }
13
+
## HTTPX2 { #httpx2 }
14
14
15
15
Auch wenn Ihre **FastAPI**-Anwendung normale `def`-Funktionen anstelle von `async def` verwendet, handelt es sich darunter immer noch um eine `async`-Anwendung.
16
16
17
17
Der `TestClient` betreibt unter der Haube etwas Magie, um die asynchrone FastAPI-Anwendung in Ihren normalen `def`-Testfunktionen, mithilfe von Standard-Pytest aufzurufen. Aber diese Magie funktioniert nicht mehr, wenn wir sie in asynchronen Funktionen verwenden. Durch die asynchrone Ausführung unserer Tests können wir den `TestClient` nicht mehr in unseren Testfunktionen verwenden.
18
18
19
-
Der `TestClient` basiert auf [HTTPX](https://www.python-httpx.org) und glücklicherweise können wir es direkt verwenden, um die API zu testen.
19
+
Der `TestClient` basiert auf [HTTPX2](https://pydantic.dev/docs/httpx2/) und glücklicherweise können wir es direkt verwenden, um die API zu testen.
Der möglicherweise wichtigste Teil des Callbacks besteht jedoch darin, sicherzustellen, dass Ihr API-Benutzer (der externe Entwickler) die *externe API* korrekt implementiert, gemäß den Daten, die *Ihre API* im Requestbody des Callbacks senden wird, usw.
@@ -66,7 +66,7 @@ In diesem Beispiel wird nicht der Callback selbst implementiert (das könnte nur
66
66
67
67
Der eigentliche Callback ist nur ein HTTP-Request.
68
68
69
-
Wenn Sie den Callback selbst implementieren, können Sie beispielsweise [HTTPX](https://www.python-httpx.org) oder [Requests](https://requests.readthedocs.io/) verwenden.
69
+
Wenn Sie den Callback selbst implementieren, können Sie beispielsweise [HTTPX2](https://pydantic.dev/docs/httpx2/) oder [Requests](https://requests.readthedocs.io/) verwenden.
Copy file name to clipboardExpand all lines: docs/de/docs/index.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -481,7 +481,7 @@ Für ein vollständigeres Beispiel, mit weiteren Funktionen, siehe das <a href="
481
481
***GraphQL**-Integration mit [Strawberry](https://strawberry.rocks) und anderen Bibliotheken.
482
482
* Viele zusätzliche Features (dank Starlette) wie:
483
483
***WebSockets**
484
-
* extrem einfache Tests auf Basis von HTTPX und `pytest`
484
+
* extrem einfache Tests auf Basis von HTTPX2 und `pytest`
485
485
***CORS**
486
486
***Cookie-Sessions**
487
487
* ... und mehr.
@@ -544,7 +544,7 @@ Verwendet von Pydantic:
544
544
545
545
Verwendet von Starlette:
546
546
547
-
*[`httpx`](https://www.python-httpx.org) – erforderlich, wenn Sie den `TestClient` verwenden möchten.
547
+
*[`httpx2`](https://pydantic.dev/docs/httpx2/) – erforderlich, wenn Sie den `TestClient` verwenden möchten.
548
548
*[`jinja2`](https://jinja.palletsprojects.com) – erforderlich, wenn Sie die Default-Template-Konfiguration verwenden möchten.
549
549
*[`python-multipart`](https://github.com/Kludex/python-multipart) – erforderlich, wenn Sie Formulare mittels `request.form()` <dfntitle="Konvertieren des Strings, der aus einem HTTP-Request stammt, nach Python-Daten">„parsen“</dfn> möchten.
Copy file name to clipboardExpand all lines: docs/de/docs/tutorial/testing.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,20 +2,20 @@
2
2
3
3
Dank [Starlette](https://starlette.dev/testclient/) ist das Testen von **FastAPI**-Anwendungen einfach und macht Spaß.
4
4
5
-
Es basiert auf [HTTPX](https://www.python-httpx.org), welches wiederum auf der Grundlage von Requests konzipiert wurde, es ist also sehr vertraut und intuitiv.
5
+
Es basiert auf [HTTPX2](https://pydantic.dev/docs/httpx2/), welches wiederum auf der Grundlage von Requests konzipiert wurde, es ist also sehr vertraut und intuitiv.
6
6
7
7
Damit können Sie [pytest](https://docs.pytest.org/) direkt mit **FastAPI** verwenden.
8
8
9
9
## `TestClient` verwenden { #using-testclient }
10
10
11
11
/// note | Hinweis
12
12
13
-
Um `TestClient` zu verwenden, installieren Sie zunächst [`httpx`](https://www.python-httpx.org).
13
+
Um `TestClient` zu verwenden, installieren Sie zunächst [`httpx2`](https://pydantic.dev/docs/httpx2/).
14
14
15
15
Fügen Sie es zu Ihrem Projekt hinzu:
16
16
17
17
```console
18
-
$ uv add httpx
18
+
$ uv add httpx2
19
19
```
20
20
21
21
///
@@ -26,7 +26,7 @@ Erstellen Sie einen `TestClient`, indem Sie ihm Ihre **FastAPI**-Anwendung über
26
26
27
27
Erstellen Sie Funktionen mit einem Namen, der mit `test_` beginnt (das ist eine Standard-`pytest`-Konvention).
28
28
29
-
Verwenden Sie das `TestClient`-Objekt auf die gleiche Weise wie `httpx`.
29
+
Verwenden Sie das `TestClient`-Objekt auf die gleiche Weise wie `httpx2`.
30
30
31
31
Schreiben Sie einfache `assert`-Anweisungen mit den Standard-Python-Ausdrücken, die Sie überprüfen müssen (wiederum, Standard-`pytest`).
32
32
@@ -131,7 +131,7 @@ Anschließend könnten Sie `test_main.py` mit den erweiterten Tests aktualisiere
Immer wenn der Client Informationen im Request übergeben soll und Sie nicht wissen, wie, können Sie danach suchen (googeln), wie es mit `httpx` gemacht wird, oder sogar, wie es mit `requests` gemacht wird, da das Design von HTTPX auf dem Design von Requests basiert.
134
+
Immer wenn der Client Informationen im Request übergeben soll und Sie nicht wissen, wie, können Sie danach suchen (googeln), wie es mit `httpx2` gemacht wird, oder sogar, wie es mit `requests` gemacht wird, da das Design von HTTPX2 auf dem Design von Requests basiert.
135
135
136
136
Dann machen Sie in Ihren Tests einfach das gleiche.
137
137
@@ -143,7 +143,7 @@ Z. B.:
143
143
* Um *Header* zu übergeben, verwenden Sie ein `dict` im `headers`-Parameter.
144
144
* Für *Cookies* ein `dict` im `cookies`-Parameter.
145
145
146
-
Weitere Informationen zum Übergeben von Daten an das Backend (mithilfe von `httpx` oder dem `TestClient`) finden Sie in der [HTTPX-Dokumentation](https://www.python-httpx.org).
146
+
Weitere Informationen zum Übergeben von Daten an das Backend (mithilfe von `httpx2` oder dem `TestClient`) finden Sie in der [HTTPX2-Dokumentation](https://pydantic.dev/docs/httpx2/).
Copy file name to clipboardExpand all lines: docs/en/docs/advanced/async-tests.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,13 +10,13 @@ Let's look at how we can make that work.
10
10
11
11
If we want to call asynchronous functions in our tests, our test functions have to be asynchronous. AnyIO provides a neat plugin for this, that allows us to specify that some test functions are to be called asynchronously.
12
12
13
-
## HTTPX { #httpx }
13
+
## HTTPX2 { #httpx2 }
14
14
15
15
Even if your **FastAPI** application uses normal `def` functions instead of `async def`, it is still an `async` application underneath.
16
16
17
17
The `TestClient` does some magic inside to call the asynchronous FastAPI application in your normal `def` test functions, using standard pytest. But that magic doesn't work anymore when we're using it inside asynchronous functions. By running our tests asynchronously, we can no longer use the `TestClient` inside our test functions.
18
18
19
-
The `TestClient` is based on [HTTPX](https://www.python-httpx.org), and luckily, we can use it directly to test the API.
19
+
The `TestClient` is based on [HTTPX2](https://pydantic.dev/docs/httpx2/), and luckily, we can use it directly to test the API.
But possibly the most important part of the callback is making sure that your API user (the external developer) implements the *external API* correctly, according to the data that *your API* is going to send in the request body of the callback, etc.
@@ -66,7 +66,7 @@ This example doesn't implement the callback itself (that could be just a line of
66
66
67
67
The actual callback is just an HTTP request.
68
68
69
-
When implementing the callback yourself, you could use something like [HTTPX](https://www.python-httpx.org) or [Requests](https://requests.readthedocs.io/).
69
+
When implementing the callback yourself, you could use something like [HTTPX2](https://pydantic.dev/docs/httpx2/) or [Requests](https://requests.readthedocs.io/).
0 commit comments