Skip to content

Commit

Permalink
Remove deprecation warning tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex committed Mar 20, 2023
1 parent 89149f0 commit 32ff46b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 74 deletions.
57 changes: 0 additions & 57 deletions tests/test_applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,63 +437,6 @@ def lifespan(app):
assert cleanup_complete


def test_decorator_deprecations() -> None:
app = Starlette()

with pytest.deprecated_call(
match=(
"The `exception_handler` decorator is deprecated, "
"and will be removed in version 1.0.0."
)
) as record:
app.exception_handler(500)(http_exception)
assert len(record) == 1

with pytest.deprecated_call(
match=(
"The `middleware` decorator is deprecated, "
"and will be removed in version 1.0.0."
)
) as record:

async def middleware(request, call_next):
... # pragma: no cover

app.middleware("http")(middleware)
assert len(record) == 1

with pytest.deprecated_call(
match=(
"The `route` decorator is deprecated, "
"and will be removed in version 1.0.0."
)
) as record:
app.route("/")(async_homepage)
assert len(record) == 1

with pytest.deprecated_call(
match=(
"The `websocket_route` decorator is deprecated, "
"and will be removed in version 1.0.0."
)
) as record:
app.websocket_route("/ws")(websocket_endpoint)
assert len(record) == 1

with pytest.deprecated_call(
match=(
"The `on_event` decorator is deprecated, "
"and will be removed in version 1.0.0."
)
) as record:

async def startup():
... # pragma: no cover

app.on_event("startup")(startup)
assert len(record) == 1


def test_middleware_stack_init(test_client_factory: Callable[[ASGIApp], httpx.Client]):
class NoOpMiddleware:
def __init__(self, app: ASGIApp):
Expand Down
17 changes: 0 additions & 17 deletions tests/test_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,20 +1090,3 @@ def test_host_named_repr() -> None:
)
# test for substring because repr(Router) returns unique object ID
assert repr(route).startswith("Host(host='example.com', name='app', app=")


def test_decorator_deprecations() -> None:
router = Router()

with pytest.deprecated_call():
router.route("/")(homepage)

with pytest.deprecated_call():
router.websocket_route("/ws")(websocket_endpoint)

with pytest.deprecated_call():

async def startup() -> None:
... # pragma: nocover

router.on_event("startup")(startup)

0 comments on commit 32ff46b

Please sign in to comment.