diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b5b8cff..b34e1c0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-24.04 strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14', 'pypy3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14', '3.15', 'pypy3.11'] env: # Configure a constant location for the uv cache UV_CACHE_DIR: /tmp/.uv-cache diff --git a/mocket/__init__.py b/mocket/__init__.py index fc9bf0d..7155d22 100644 --- a/mocket/__init__.py +++ b/mocket/__init__.py @@ -33,4 +33,4 @@ "FakeSSLContext", ) -__version__ = "3.14.5" +__version__ = "3.15.0" diff --git a/pyproject.toml b/pyproject.toml index a3ad9d4..3b7eed1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,7 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development", diff --git a/tests/test_http.py b/tests/test_http.py index fbb0557..af880b1 100644 --- a/tests/test_http.py +++ b/tests/test_http.py @@ -70,8 +70,8 @@ class TrueHttpEntryTestCase(HttpTestCase): @mocketize def test_truesendall(self): url = "http://httpbin.local/ip" - resp = urlopen(url) - self.assertEqual(resp.code, 200) + with urlopen(url) as resp: + self.assertEqual(resp.code, 200) resp = requests.get(url) self.assertEqual(resp.status_code, 200) @@ -81,10 +81,11 @@ def test_truesendall_with_recording(self): ): url = "http://httpbin.local/ip" - urlopen(url) + with urlopen(url): + pass requests.get(url) - resp = urlopen(url) - self.assertEqual(resp.code, 200) + with urlopen(url) as resp: + self.assertEqual(resp.code, 200) resp = requests.get(url) self.assertEqual(resp.status_code, 200) assert "origin" in resp.json() @@ -233,10 +234,10 @@ def test_sendall_double(self): Entry.GET, "http://testme.org/", Response(status=404), Response() ) self.assertRaises(HTTPError, urlopen, "http://testme.org/") - response = urlopen("http://testme.org/") - self.assertEqual(response.code, 200) - response = urlopen("http://testme.org/") - self.assertEqual(response.code, 200) + with urlopen("http://testme.org/") as response: + self.assertEqual(response.code, 200) + with urlopen("http://testme.org/") as response: + self.assertEqual(response.code, 200) self.assertEqual(len(Mocket.request_list()), 3) @mocketize diff --git a/tests/test_httpx.py b/tests/test_httpx.py index add53de..a2ba944 100644 --- a/tests/test_httpx.py +++ b/tests/test_httpx.py @@ -26,7 +26,7 @@ async def perform_async_transactions(): assert response.status_code == 404 assert response.text == body - response = await client.post(url, data=body * 6) + response = await client.post(url, content=body * 6) assert response.status_code == 201 assert response.text == body * 2 diff --git a/tests/test_redis.py b/tests/test_redis.py index fb6ec35..e2174a9 100644 --- a/tests/test_redis.py +++ b/tests/test_redis.py @@ -126,7 +126,7 @@ def test_get_unicode(self): @mocketize def test_hm(self): h = {b"f1": b"one", b"f2": b"two"} - self.assertTrue(self.rclient.hmset("hash", h)) + self.assertEqual(self.rclient.hset("hash", mapping=h), len(h)) self.assertEqual(self.rclient.hgetall("hash"), h) @mocketize