From 6dc8c2a66dba4a07264f0267a11fa78911e36aa0 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 7 Dec 2024 08:43:37 -0300 Subject: [PATCH 1/3] Drop EOL Python 3.8 support --- .github/workflows/test.yml | 9 +++------ changelog/1162.removal.rst | 1 + pyproject.toml | 3 +-- tox.ini | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) create mode 100644 changelog/1162.removal.rst diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b433b4c..c06c4b4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,8 +34,7 @@ jobs: fail-fast: false matrix: tox_env: - - "py38-pytestmin" - - "py38-pytestlatest" + - "py39-pytestmin" - "py39-pytestlatest" - "py310-pytestlatest" - "py311-pytestlatest" @@ -47,10 +46,8 @@ jobs: os: [ubuntu-latest, windows-latest] include: - - tox_env: "py38-pytestmin" - python: "3.8" - - tox_env: "py38-pytestlatest" - python: "3.8" + - tox_env: "py39-pytestmin" + python: "3.9" - tox_env: "py39-pytestlatest" python: "3.9" - tox_env: "py310-pytestlatest" diff --git a/changelog/1162.removal.rst b/changelog/1162.removal.rst new file mode 100644 index 0000000..e0b5536 --- /dev/null +++ b/changelog/1162.removal.rst @@ -0,0 +1 @@ +Dropped support for EOL Python 3.8. \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 70cb2b0..67b6b3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,14 +25,13 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.8" +requires-python = ">=3.9" dependencies = [ "execnet>=2.1", "pytest>=7.0.0", diff --git a/tox.ini b/tox.ini index d6af92c..4d66175 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] envlist = linting - py{38,39,310,311,312,313}-pytestlatest + py{39,310,311,312,313}-pytestlatest py310-pytestmain py310-psutil py310-setproctitle From 475b346fd91c909a01213c06c9cbd2b688b7c233 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 7 Dec 2024 08:46:25 -0300 Subject: [PATCH 2/3] Run pyupgrade --py39-plus on all files --- src/xdist/_path.py | 2 +- src/xdist/dsession.py | 2 +- src/xdist/looponfail.py | 6 +++--- src/xdist/newhooks.py | 2 +- src/xdist/remote.py | 8 ++++---- src/xdist/report.py | 2 +- src/xdist/scheduler/each.py | 2 +- src/xdist/scheduler/load.py | 2 +- src/xdist/scheduler/loadscope.py | 2 +- src/xdist/scheduler/protocol.py | 2 +- src/xdist/scheduler/worksteal.py | 2 +- src/xdist/workermanage.py | 2 +- testing/conftest.py | 4 ++-- testing/test_dsession.py | 2 +- testing/test_remote.py | 3 +-- 15 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/xdist/_path.py b/src/xdist/_path.py index 1732300..22881fc 100644 --- a/src/xdist/_path.py +++ b/src/xdist/_path.py @@ -1,8 +1,8 @@ +from collections.abc import Iterator from itertools import chain import os from pathlib import Path from typing import Callable -from typing import Iterator def visit_path( diff --git a/src/xdist/dsession.py b/src/xdist/dsession.py index 62079a2..5bf7d98 100644 --- a/src/xdist/dsession.py +++ b/src/xdist/dsession.py @@ -1,12 +1,12 @@ from __future__ import annotations +from collections.abc import Sequence from enum import auto from enum import Enum from queue import Empty from queue import Queue import sys from typing import Any -from typing import Sequence import warnings import execnet diff --git a/src/xdist/looponfail.py b/src/xdist/looponfail.py index aa8852f..128127a 100644 --- a/src/xdist/looponfail.py +++ b/src/xdist/looponfail.py @@ -9,12 +9,12 @@ the controlling process which should best never happen. from __future__ import annotations +from collections.abc import Sequence import os from pathlib import Path import sys import time from typing import Any -from typing import Sequence from _pytest._io import TerminalWriter import execnet @@ -158,9 +158,9 @@ def repr_pytest_looponfailinfo( def init_worker_session( - channel: "execnet.Channel", # noqa: UP037 + channel: execnet.Channel, args: list[str], - option_dict: dict[str, "Any"], # noqa: UP037 + option_dict: dict[str, Any], ) -> None: import os import sys diff --git a/src/xdist/newhooks.py b/src/xdist/newhooks.py index 5bfce7c..2327536 100644 --- a/src/xdist/newhooks.py +++ b/src/xdist/newhooks.py @@ -14,9 +14,9 @@ must be taken in plugins in case ``xdist`` is not installed. Please see: from __future__ import annotations +from collections.abc import Sequence import os from typing import Any -from typing import Sequence from typing import TYPE_CHECKING import execnet diff --git a/src/xdist/remote.py b/src/xdist/remote.py index 5439f6f..0a30306 100644 --- a/src/xdist/remote.py +++ b/src/xdist/remote.py @@ -9,16 +9,16 @@ needs not to be installed in remote environments. from __future__ import annotations import collections +from collections.abc import Generator +from collections.abc import Iterable +from collections.abc import Sequence import contextlib import enum import os import sys import time from typing import Any -from typing import Generator -from typing import Iterable from typing import Literal -from typing import Sequence from typing import TypedDict from typing import Union import warnings @@ -98,7 +98,7 @@ class TestQueue: self._items = collections.deque(iterable) @contextlib.contextmanager - def lock(self) -> Generator[collections.deque[Item], None, None]: + def lock(self) -> Generator[collections.deque[Item]]: with self._lock: try: yield self._items diff --git a/src/xdist/report.py b/src/xdist/report.py index ea00e5b..2eb4d21 100644 --- a/src/xdist/report.py +++ b/src/xdist/report.py @@ -1,7 +1,7 @@ from __future__ import annotations +from collections.abc import Sequence from difflib import unified_diff -from typing import Sequence def report_collection_diff( diff --git a/src/xdist/scheduler/each.py b/src/xdist/scheduler/each.py index aa4f7ba..8552b53 100644 --- a/src/xdist/scheduler/each.py +++ b/src/xdist/scheduler/each.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Sequence +from collections.abc import Sequence import pytest diff --git a/src/xdist/scheduler/load.py b/src/xdist/scheduler/load.py index 9d153bb..ac011e5 100644 --- a/src/xdist/scheduler/load.py +++ b/src/xdist/scheduler/load.py @@ -1,7 +1,7 @@ from __future__ import annotations +from collections.abc import Sequence from itertools import cycle -from typing import Sequence import pytest diff --git a/src/xdist/scheduler/loadscope.py b/src/xdist/scheduler/loadscope.py index a4d63b2..ee3f2fd 100644 --- a/src/xdist/scheduler/loadscope.py +++ b/src/xdist/scheduler/loadscope.py @@ -1,8 +1,8 @@ from __future__ import annotations from collections import OrderedDict +from collections.abc import Sequence from typing import NoReturn -from typing import Sequence import pytest diff --git a/src/xdist/scheduler/protocol.py b/src/xdist/scheduler/protocol.py index 0435d15..2e9129c 100644 --- a/src/xdist/scheduler/protocol.py +++ b/src/xdist/scheduler/protocol.py @@ -1,7 +1,7 @@ from __future__ import annotations +from collections.abc import Sequence from typing import Protocol -from typing import Sequence from xdist.workermanage import WorkerController diff --git a/src/xdist/scheduler/worksteal.py b/src/xdist/scheduler/worksteal.py index fd20848..28708fc 100644 --- a/src/xdist/scheduler/worksteal.py +++ b/src/xdist/scheduler/worksteal.py @@ -1,7 +1,7 @@ from __future__ import annotations +from collections.abc import Sequence from typing import NamedTuple -from typing import Sequence import pytest diff --git a/src/xdist/workermanage.py b/src/xdist/workermanage.py index 44d1be4..08ba243 100644 --- a/src/xdist/workermanage.py +++ b/src/xdist/workermanage.py @@ -1,5 +1,6 @@ from __future__ import annotations +from collections.abc import Sequence import enum import fnmatch import os @@ -9,7 +10,6 @@ import sys from typing import Any from typing import Callable from typing import Literal -from typing import Sequence from typing import Union import uuid import warnings diff --git a/testing/conftest.py b/testing/conftest.py index 5186b8b..717e667 100644 --- a/testing/conftest.py +++ b/testing/conftest.py @@ -1,8 +1,8 @@ from __future__ import annotations +from collections.abc import Generator import shutil from typing import Callable -from typing import Generator import execnet import pytest @@ -12,7 +12,7 @@ pytest_plugins = "pytester" @pytest.fixture(autouse=True) -def _divert_atexit(monkeypatch: pytest.MonkeyPatch) -> Generator[None, None, None]: +def _divert_atexit(monkeypatch: pytest.MonkeyPatch) -> Generator[None]: import atexit finalizers = [] diff --git a/testing/test_dsession.py b/testing/test_dsession.py index 184fe35..680b7ae 100644 --- a/testing/test_dsession.py +++ b/testing/test_dsession.py @@ -1,8 +1,8 @@ from __future__ import annotations +from collections.abc import Sequence from typing import Any from typing import cast -from typing import Sequence from typing import TYPE_CHECKING import execnet diff --git a/testing/test_remote.py b/testing/test_remote.py index b995cc4..ba24295 100644 --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -7,7 +7,6 @@ import sys from typing import Any from typing import Callable from typing import cast -from typing import Dict from typing import Union import uuid @@ -90,7 +89,7 @@ def worker(request: pytest.FixtureRequest, pytester: pytest.Pytester) -> WorkerS class TestWorkerInteractor: UnserializerReport = Callable[ - [Dict[str, Any]], Union[pytest.CollectReport, pytest.TestReport] + [dict[str, Any]], Union[pytest.CollectReport, pytest.TestReport] ] @pytest.fixture From 31bee7c56784a2ddff684851c7dca509bb06a2d1 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 7 Dec 2024 08:57:08 -0300 Subject: [PATCH 3/3] Revert using direct annotations in looponfail.py We need to use string annotations otherwise we get this error: ``` ValueError: ("the use of non-builtin globals isn't supported", ['execnet', 'Any']) ``` --- src/xdist/looponfail.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xdist/looponfail.py b/src/xdist/looponfail.py index 128127a..38f1e6f 100644 --- a/src/xdist/looponfail.py +++ b/src/xdist/looponfail.py @@ -158,9 +158,9 @@ def repr_pytest_looponfailinfo( def init_worker_session( - channel: execnet.Channel, + channel: "execnet.Channel", # noqa: UP037 args: list[str], - option_dict: dict[str, Any], + option_dict: dict[str, "Any"], # noqa: UP037 ) -> None: import os import sys