Commit Graph

18 Commits

Author SHA1 Message Date
Marcelo Trylesinski 8a99adfb58
docs: use `transport` instead of directly pass the app to AsyncClient (#2784) 2024-12-05 09:53:54 +01:00
Marcelo Trylesinski 4ca0a8757a
Downgrade mkdocs-material (#2439) 2024-01-23 01:29:01 -07:00
Marcelo Trylesinski cc20c8606e
Deprecate `on_startup` and `on_shutdown` events (#2070)
* Revert "Support lifespan state (#2060)"

This reverts commit da6461b239.

* new implementation

* Deprecate `on_startup` and `on_shutdown` events

* Rename `events.md` by `lifespan.md`

---------

Co-authored-by: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com>
2023-03-09 23:30:28 +01:00
arl bf5d7357b5
docs(testclient): change requests url to httpx url (#1937)
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2022-11-05 17:17:32 +01:00
Marcelo Trylesinski 6765502c1e
Replace HTTP client on TestClient from `requests` to `httpx` (#1376) 2022-09-06 07:43:32 +02:00
Redowan Delowar 643c3f20e3
Explain 'TestClient(app) as client' vs 'client = TestClient(app)' (#1… (#1747)
* Explain 'TestClient(app) as client' vs 'client = TestClient(app)' (#1733)

* Nit (#1733)

* Update docs/testclient.md (#1733)

Co-authored-by: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com>

* Update docs/testclient.md

Co-authored-by: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com>

* Update docs/testclient.md

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>

* Update docs/testclient.md

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>

Co-authored-by: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2022-07-10 14:23:40 +02:00
Adrian Garcia Badaracco f24d31bd4d
Document using httpx for async tests (#1728) 2022-07-06 11:43:04 -05:00
Amin Alaee f693e682dc
Add more TestClient examples (#1685) 2022-06-15 15:47:55 +02:00
Marcelo Trylesinski e7a92ee4cd
Document unsuported `params` on `TestClient.websocket_connect` (#1630) 2022-05-09 20:44:42 +02:00
Sebastian Marines 81bd557de6
Fix typo in docs/testclient.md (#1429)
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2022-01-26 11:34:25 +01:00
Thomas Grainger d222b87cb4
TestClient accepts backend and backend_options as arguments to constructor (#1211)
as opposed to ClassVar assignment 

Co-authored-by: Jamie Hewland <jhewland@gmail.com>
Co-authored-by: Jordan Speicher <jordan@jspeicher.com>
Co-authored-by: Jordan Speicher <uSpike@users.noreply.github.com>
2021-06-28 21:36:13 +01:00
Jordan Speicher 42592d68e5
anyio integration (#1157)
* First whack at anyio integration

* Fix formatting

* Remove debug messages

* mypy fixes

* Update README.md

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>

* Fix install_requires typo

* move_on_after blocks if deadline is too small

* Linter fixes

* Improve WSGI structured concurrency

* Tests use anyio

* Checkin progress on testclient

* Prep for anyio 3

* Remove debug backend option

* Use anyio 3.0.0rc1

* Remove old style executor from GraphQLApp

* Fix extra import

* Don't cancel task scope early

* Wait for wsgi sender to finish before exiting

* Use memory object streams in websocket tests

* Test on asyncio, asyncio+uvloop, and trio

* Formatting fixes

* run_until_first_complete doesn't need a return

* Fix middleware app call

* Simplify middleware exceptions

* Use anyio for websocket test

* Set STARLETTE_TESTCLIENT_ASYNC_BACKEND in tests

* Pass async backend to portal

* Formatting fixes

* Bump anyio

* Cleanup portals and add TestClient.async_backend

* Use anyio.run_async_from_thread to send from worker thread

* Use websocket_connect as context manager

* Document changes in TestClient

* Formatting fix

* Fix websocket raises coverage

* Update to anyio 3.0.0rc3 and replace aiofiles

* Apply suggestions from code review

Co-authored-by: Alex Grönholm <alex.gronholm@nextday.fi>

* Bump to require anyio 3.0.0 final

* Remove mention of aiofiles in README.md

* Pin jinja2 to releases before 3 due to DeprecationWarnings

* Add task_group as application attribute

* Remove run_until_first_complete

* Undo jinja pin

* Refactor anyio.sleep into an event

* Use one less task in test_websocket_concurrency_pattern

* Apply review suggestions

* Rename argument

* fix start_task_soon type

* fix BaseHTTPMiddleware when used without Starlette

* Testclient receive() is a non-trapping function if the response is already complete

This allows for a zero deadline when waiting for a disconnect message

* Use variable annotation for async_backend

* Update docs regarding dependency on anyio

* Use CancelScope instead of move_on_after in request.is_disconnected

* Cancel task group after returning middleware response

Add test for https://github.com/encode/starlette/issues/1022

* Add link to anyio backend options in testclient docs

* Add types-dataclasses

* Re-implement starlette.concurrency.run_until_first_complete and add a test

* Fix type on handler callable

* Apply review comments to clarify run_until_first_complete scope

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Co-authored-by: Alex Grönholm <alex.gronholm@nextday.fi>
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2021-06-18 15:48:43 +01:00
Smart 14139c2886
Update testclient.md (#1000)
Fix bad exception name

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-07-15 19:29:20 +02:00
Rafał Pitoń b155c44a21 Simplify example apps code to plain functions 2019-06-14 12:53:38 +02:00
rafalp 765bdd2fa6 Update response() calls in docs for ASGI 3 2019-06-14 12:39:41 +02:00
Tom Christie 1ee194739f
WebSockets now default to sending JSON using text dataframes (#349) 2019-01-25 15:27:39 +00:00
Tom Christie d5c798e6b8
Example ASGI apps now ensure scope['type'] is expected message type. (#348) 2019-01-25 14:40:33 +00:00
Tom Christie 78d1829758
Version 0.3 (#57)
* Renamings

* Version 0.3.0

* Black formatting

* Update docs for 0.3
2018-09-05 11:39:38 +01:00