python-aiohttp/0002-Fix-pytest.warns-None-...

96 lines
2.6 KiB
Diff

From 4e637fc268bdd976490aaacb8c28a204f6955156 Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
Date: Tue, 29 Mar 2022 00:24:49 +0200
Subject: [PATCH 2/2] Fix pytest.warns(None) usage, deprecated in pytest 7
(#6664)
* remove pytest.warns(None)
Deprecated misuse of pytest.warns()
https://docs.pytest.org/en/latest/deprecations.html#using-pytest-warns-none
* Remove duplicate test
test_session_close_awaitable() does the exact same thing and should throw a deprecation warning already which is caught by the general filter
* PR 6664 metadata
* "Fix" spelling. Bots everywhere!
* Update 6663.bugfix
* Update 6663.bugfix
Co-authored-by: Sam Bull <aa6bs0@sambull.org>
(cherry picked from commit 936e682d1ab6c833b3e5f0cc3596882cb9cb2444)
---
CHANGES/6663.bugfix | 1 +
CONTRIBUTORS.txt | 1 +
tests/test_client_functional.py | 19 +++----------------
3 files changed, 5 insertions(+), 16 deletions(-)
create mode 100644 CHANGES/6663.bugfix
diff --git a/CHANGES/6663.bugfix b/CHANGES/6663.bugfix
new file mode 100644
index 00000000..ee89799a
--- /dev/null
+++ b/CHANGES/6663.bugfix
@@ -0,0 +1 @@
+Remove a deprecated usage of pytest.warns(None)
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 52c6b5c3..d0dc04fe 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -50,6 +50,7 @@ Artem Yushkovskiy
Arthur Darcet
Austin Scola
Ben Bader
+Ben Greiner
Ben Timby
Benedikt Reinartz
Bob Haddleton
diff --git a/tests/test_client_functional.py b/tests/test_client_functional.py
index 77126e14..479aca33 100644
--- a/tests/test_client_functional.py
+++ b/tests/test_client_functional.py
@@ -2428,32 +2428,19 @@ async def test_drop_auth_on_redirect_to_other_host(
async def test_async_with_session() -> None:
- with pytest.warns(None) as cm:
- async with aiohttp.ClientSession() as session:
- pass
- assert len(cm.list) == 0
+ async with aiohttp.ClientSession() as session:
+ pass
assert session.closed
async def test_session_close_awaitable() -> None:
session = aiohttp.ClientSession()
- with pytest.warns(None) as cm:
- await session.close()
- assert len(cm.list) == 0
+ await session.close()
assert session.closed
-async def test_close_run_until_complete_not_deprecated() -> None:
- session = aiohttp.ClientSession()
-
- with pytest.warns(None) as cm:
- await session.close()
-
- assert len(cm.list) == 0
-
-
async def test_close_resp_on_error_async_with_session(aiohttp_server) -> None:
async def handler(request):
resp = web.StreamResponse(headers={"content-length": "100"})
--
2.35.1