Skip to content

Commit 7e04040

Browse files
Add Python 3.14, drop 3.8 and 3.9 (#264)
* Add Python 3.14, drop 3.8 and 3.9 * reformat code * disable ssl deprecation for min-deps test
1 parent 33c0af3 commit 7e04040

File tree

6 files changed

+28
-15
lines changed

6 files changed

+28
-15
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ jobs:
4343
strategy:
4444
fail-fast: false
4545
matrix:
46-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
46+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
4747
os: ["ubuntu-latest"]
4848
experimental: [false]
4949
nox-session: ['']
5050
include:
51-
- python-version: "3.8"
51+
- python-version: "3.10"
5252
os: "ubuntu-latest"
5353
experimental: false
5454
nox-session: "test-min-deps"

noxfile.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
@nox.session()
3131
def format(session):
3232
session.install("black~=24.0", "isort", "pyupgrade")
33-
session.run("black", "--target-version=py37", *SOURCE_FILES)
33+
session.run("black", "--target-version=py310", *SOURCE_FILES)
3434
session.run("isort", *SOURCE_FILES)
3535
session.run("python", "utils/license-headers.py", "fix", *SOURCE_FILES)
3636

@@ -52,14 +52,14 @@ def lint(session):
5252
"python", "-m", "pip", "uninstall", "--yes", "types-urllib3", silent=True
5353
)
5454
session.install(".[develop]")
55-
session.run("black", "--check", "--target-version=py37", *SOURCE_FILES)
55+
session.run("black", "--check", "--target-version=py310", *SOURCE_FILES)
5656
session.run("isort", "--check", *SOURCE_FILES)
5757
session.run("flake8", "--ignore=E501,W503,E203,E704", *SOURCE_FILES)
5858
session.run("python", "utils/license-headers.py", "check", *SOURCE_FILES)
5959
session.run("mypy", "--strict", "--show-error-codes", "elastic_transport/")
6060

6161

62-
@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"])
62+
@nox.session(python=["3.10", "3.11", "3.12", "3.13", "3.14"])
6363
def test(session):
6464
session.install(".[develop]")
6565
session.run(
@@ -71,7 +71,7 @@ def test(session):
7171
session.run("coverage", "report", "-m")
7272

7373

74-
@nox.session(name="test-min-deps", python="3.8")
74+
@nox.session(name="test-min-deps", python="3.10")
7575
def test_min_deps(session):
7676
session.install("-r", "requirements-min.txt", ".[develop]", silent=False)
7777
session.run(

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"certifi",
5555
"sniffio",
5656
],
57-
python_requires=">=3.8",
57+
python_requires=">=3.10",
5858
extras_require={
5959
"develop": [
6060
"pytest",
@@ -86,12 +86,11 @@
8686
"Operating System :: OS Independent",
8787
"Programming Language :: Python",
8888
"Programming Language :: Python :: 3",
89-
"Programming Language :: Python :: 3.8",
90-
"Programming Language :: Python :: 3.9",
9189
"Programming Language :: Python :: 3.10",
9290
"Programming Language :: Python :: 3.11",
9391
"Programming Language :: Python :: 3.12",
9492
"Programming Language :: Python :: 3.13",
93+
"Programming Language :: Python :: 3.14",
9594
"Programming Language :: Python :: Implementation :: CPython",
9695
"Programming Language :: Python :: Implementation :: PyPy",
9796
],

tests/async_/test_async_transport.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,10 @@ async def test_mark_dead_error_doesnt_raise():
301301
randomize_nodes_in_pool=False,
302302
)
303303
bad_node = t.node_pool._all_nodes[NodeConfig("http", "localhost", 80)]
304-
with mock.patch.object(t.node_pool, "mark_dead") as mark_dead, mock.patch.object(
305-
t, "sniff"
306-
) as sniff:
304+
with (
305+
mock.patch.object(t.node_pool, "mark_dead") as mark_dead,
306+
mock.patch.object(t, "sniff") as sniff,
307+
):
307308
sniff.side_effect = TransportError("sniffing error!")
308309
await t.perform_request("GET", "/")
309310
mark_dead.assert_called_with(bad_node)

tests/test_httpserver.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,26 @@
1818
import warnings
1919

2020
import pytest
21+
import requests
22+
import urllib3
2123

2224
from elastic_transport import Transport
2325

2426

2527
@pytest.mark.parametrize("node_class", ["urllib3", "requests"])
2628
def test_simple_request(node_class, https_server_ip_node_config):
29+
# when testing minimum urllib3 and requests dependencies, we disable
30+
# the deprecation warning for ssl.match_hostname()
31+
silence_ssl_deprecation = (
32+
node_class == "urllib3" and urllib3.__version__ == "1.26.2"
33+
) or (node_class == "requests" and requests.__version__ == "2.26.0")
34+
2735
with warnings.catch_warnings():
2836
warnings.simplefilter("error")
37+
if silence_ssl_deprecation:
38+
warnings.filterwarnings(
39+
"ignore", ".*match_hostname.*deprecated", DeprecationWarning
40+
)
2941

3042
t = Transport([https_server_ip_node_config], node_class=node_class)
3143

tests/test_transport.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,10 @@ def test_sniff_on_node_failure_error_doesnt_raise():
309309
randomize_nodes_in_pool=False,
310310
)
311311
bad_node = t.node_pool._all_nodes[NodeConfig("http", "localhost", 80)]
312-
with mock.patch.object(t, "sniff") as sniff, mock.patch.object(
313-
t.node_pool, "mark_dead"
314-
) as mark_dead:
312+
with (
313+
mock.patch.object(t, "sniff") as sniff,
314+
mock.patch.object(t.node_pool, "mark_dead") as mark_dead,
315+
):
315316
sniff.side_effect = TransportError("sniffing error!")
316317
t.perform_request("GET", "/")
317318
mark_dead.assert_called_with(bad_node)

0 commit comments

Comments
 (0)