From 3de2777421b25f8bc1dcd115143c3e1b5ae9f15a Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Sat, 25 Jul 2026 13:34:38 -0700 Subject: [PATCH] tests: target Python 3.8 as the minimum Python version This version is already two releases out of support, but is "only" 7 years old so is probably still being used in the real world. Document this version along with some other testing dependencies. Remove code support for earlier versions. Disable ruff checks that need a newer version. --- docs/INTERNALS.md | 13 +++++++++++++ scripts/pythonlint.sh | 6 ++++-- tests/dictserver.py | 2 -- tests/http/testenv/ports.py | 3 +-- tests/negtelnetserver.py | 9 +-------- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/docs/INTERNALS.md b/docs/INTERNALS.md index 244d7c46c3..77d17e83a0 100644 --- a/docs/INTERNALS.md +++ b/docs/INTERNALS.md @@ -64,6 +64,19 @@ these or later versions: - perl 5.8 (2002-07-19), on Windows: 5.22 (2015-06-01) - Visual Studio 2010 10.0 (2010-04-12 - 2020-07-14) +## Testing + +Certain tests require the following packages to operate. In some cases, tests +that do not find the necessary requirements are automatically skipped. + +- OpenSSL (see above) +- nghttp2 (see above) +- OpenSSH +- perl (see above) +- pytest +- Python 3.8 (2019-10-14) +- stunnel + ## Library Symbols All symbols used internally in libcurl must use a `Curl_` prefix if they are diff --git a/scripts/pythonlint.sh b/scripts/pythonlint.sh index a6d6aa2dd4..1385533064 100755 --- a/scripts/pythonlint.sh +++ b/scripts/pythonlint.sh @@ -29,9 +29,11 @@ set -eu -ruff check --extend-select=B007,B016,C405,C416,COM818,D200,D213,D204,D401,\ +ruff check --target-version=py38 \ +--extend-select=B007,B016,C405,C416,COM818,D200,D213,D204,D401,\ D415,FURB129,N818,PERF401,PERF403,PIE790,PIE808,PLW0127,Q004,RUF010,SIM101,\ SIM117,SIM118,TRY400,TRY401,RET503,RET504,UP004,B018,B904,RSE102,RET505,I001 \ +--ignore=FA100 \ "$@" # Checks that are in preview only, since --preview otherwise turns them all on -ruff check --preview --select=E301,E302,E303,E304,E305,E306,E502 "$@" +ruff check --target-version=py38 --preview --select=E301,E302,E303,E304,E305,E306,E502 "$@" diff --git a/tests/dictserver.py b/tests/dictserver.py index 87a00d61d0..bff6e80157 100755 --- a/tests/dictserver.py +++ b/tests/dictserver.py @@ -25,8 +25,6 @@ # """DICT server.""" -from __future__ import absolute_import, division, print_function, unicode_literals - import argparse import logging import os diff --git a/tests/http/testenv/ports.py b/tests/http/testenv/ports.py index 2436d40767..8f25daedca 100644 --- a/tests/http/testenv/ports.py +++ b/tests/http/testenv/ports.py @@ -25,8 +25,7 @@ import logging import os import socket -from collections.abc import Callable -from typing import Dict +from typing import Callable, Dict from filelock import FileLock diff --git a/tests/negtelnetserver.py b/tests/negtelnetserver.py index ad7cb53e98..8d074f5046 100755 --- a/tests/negtelnetserver.py +++ b/tests/negtelnetserver.py @@ -22,22 +22,15 @@ # """A telnet server which negotiates.""" -from __future__ import absolute_import, division, print_function, unicode_literals - import argparse import logging import os import socket +import socketserver import sys from util import ClosingFileHandler -if sys.version_info.major >= 3: - import socketserver -else: - import SocketServer as socketserver - - log = logging.getLogger(__name__) HOST = "localhost" IDENT = "NTEL"