From 14504e406f5cc8aee3956746c24761ee2ff01cd2 Mon Sep 17 00:00:00 2001 From: Andy Kluger Date: Fri, 23 May 2025 22:56:10 -0400 Subject: [PATCH 1/3] Update test pkg: fake_with_deps - The version range for pyzmq was bumped for compatibility with newer ecosystem - The format was changed to a pyproject.toml, addressing this warning: DEPRECATION: Building 'fake_with_deps' using the legacy setup.py bdist_wheel mechanism, which will be removed in a future version. pip 25.3 will enforce this behaviour change. A possible replacement is to use the standardized build interface by setting the `--use-pep517` option, (possibly combined with `--no-build-isolation`), or adding a `pyproject.toml` file to the source tree of 'fake_with_deps'. Discussion can be found at https://github.com/pypa/pip/issues/6334 The rest of the test packages may be updated accordingly in the future. --- .../fake_with_deps/fake_with_deps/__init__.py | 0 .../packages/fake_with_deps/pyproject.toml | 27 +++++++++++++++++++ .../packages/fake_with_deps/setup.py | 23 ---------------- 3 files changed, 27 insertions(+), 23 deletions(-) create mode 100644 tests/test_data/packages/fake_with_deps/fake_with_deps/__init__.py create mode 100644 tests/test_data/packages/fake_with_deps/pyproject.toml delete mode 100644 tests/test_data/packages/fake_with_deps/setup.py diff --git a/tests/test_data/packages/fake_with_deps/fake_with_deps/__init__.py b/tests/test_data/packages/fake_with_deps/fake_with_deps/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/test_data/packages/fake_with_deps/pyproject.toml b/tests/test_data/packages/fake_with_deps/pyproject.toml new file mode 100644 index 000000000..0a14bf468 --- /dev/null +++ b/tests/test_data/packages/fake_with_deps/pyproject.toml @@ -0,0 +1,27 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "fake_with_deps" +description = "Fake package with dependencies" +authors = [{name = "jazzband"}] +# license = "0BSD" +# Deprecated license table for Python 3.8's latest setuptools compatibility: +license = {text = "0BSD"} +version = "0.1" +dependencies = [ + "python-dateutil>=2.4.2,<2.5", + "colorama<0.4.0,>=0.3.7", + "cornice<1.1,>=1.0.0", + "enum34<1.1.7,>=1.0.4", + "six>1.5,<=1.8", + "ipaddress<1.1,>=1.0.16", + "jsonschema<3.0,>=2.4.0", + "pyramid<1.6,>=1.5.7", + "pyzmq<26.3.0,>=26.2.0", + "simplejson>=3.5,!=3.8,>3.9", + "SQLAlchemy!=0.9.5,<2.0.0,>=0.7.8,>=1.0.0", + "python-memcached>=1.57,<2.0", + "xmltodict<=0.11,>=0.4.6" +] diff --git a/tests/test_data/packages/fake_with_deps/setup.py b/tests/test_data/packages/fake_with_deps/setup.py deleted file mode 100644 index 0e760b335..000000000 --- a/tests/test_data/packages/fake_with_deps/setup.py +++ /dev/null @@ -1,23 +0,0 @@ -from __future__ import annotations - -from setuptools import setup - -setup( - name="fake_with_deps", - version=0.1, - install_requires=[ - "python-dateutil>=2.4.2,<2.5", - "colorama<0.4.0,>=0.3.7", - "cornice<1.1,>=1.0.0", - "enum34<1.1.7,>=1.0.4", - "six>1.5,<=1.8", - "ipaddress<1.1,>=1.0.16", - "jsonschema<3.0,>=2.4.0", - "pyramid<1.6,>=1.5.7", - "pyzmq<14.8,>=14.7.0", - "simplejson>=3.5,!=3.8,>3.9", - "SQLAlchemy!=0.9.5,<2.0.0,>=0.7.8,>=1.0.0", - "python-memcached>=1.57,<2.0", - "xmltodict<=0.11,>=0.4.6", - ], -) From c7f128e7c533033c2436b52c972eee521fe3890c Mon Sep 17 00:00:00 2001 From: Andy Kluger Date: Fri, 23 May 2025 23:04:16 -0400 Subject: [PATCH 2/3] Introduce compatibility with click>=8.2, maintaining compatibility with <8.2 --- pyproject.toml | 2 +- tests/conftest.py | 6 +++++- tests/test_logging.py | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a6624f8fb..6a40c09b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ keywords = ["pip", "requirements", "packaging"] dependencies = [ # direct dependencies "build >= 1.0.0", - "click >= 8, < 8.2", + "click >= 8", "pip >= 22.2", "pyproject_hooks", "tomli; python_version < '3.11'", diff --git a/tests/conftest.py b/tests/conftest.py index 7310676a7..db90ecc57 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8,6 +8,7 @@ from contextlib import contextmanager from dataclasses import dataclass, field from functools import partial +from importlib.metadata import version as version_of from pathlib import Path from textwrap import dedent from typing import Any, cast @@ -227,7 +228,10 @@ def from_editable(): @pytest.fixture def runner(): - cli_runner = CliRunner(mix_stderr=False) + if Version(version_of("click")) < Version("8.2"): + cli_runner = CliRunner(mix_stderr=False) + else: + cli_runner = CliRunner() with cli_runner.isolated_filesystem(): yield cli_runner diff --git a/tests/test_logging.py b/tests/test_logging.py index 50c110387..60c4cbf70 100644 --- a/tests/test_logging.py +++ b/tests/test_logging.py @@ -9,7 +9,8 @@ def test_indentation(runner): """ log = LogContext(indent_width=2) - with runner.isolation() as (_, stderr): + with runner.isolation() as streams: + stderr = streams[1] log.log("Test message 1") with log.indentation(): log.log("Test message 2") From 9e1c078630c7e407c8b7cb70327cbbb73e74fefd Mon Sep 17 00:00:00 2001 From: Andy Kluger Date: Fri, 23 May 2025 23:08:18 -0400 Subject: [PATCH 3/3] Use --strip-extras to suppress irrelevant warning for test_all_no_emit_options --- tests/test_cli_compile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_cli_compile.py b/tests/test_cli_compile.py index 7f862b5b3..25c6bdf6b 100644 --- a/tests/test_cli_compile.py +++ b/tests/test_cli_compile.py @@ -438,7 +438,9 @@ def test_trusted_host_envvar(monkeypatch, pip_conf, runner): def test_all_no_emit_options(runner, options): with open("requirements.in", "w"): pass - out = runner.invoke(cli, ["--output-file", "-", "--no-header", *options]) + out = runner.invoke( + cli, ["--output-file", "-", "--no-header", "--strip-extras", *options] + ) assert out.stdout.strip().splitlines() == []