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_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() == [] 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", - ], -) 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")