From 5bad73cd93ee6d111ed723fe57e0cc8ece678cd6 Mon Sep 17 00:00:00 2001 From: David Hotham Date: Fri, 19 May 2023 13:54:18 +0100 Subject: [PATCH] drop support for python 3.7 (#7674) --- .cirrus.yml | 1 - .github/workflows/main.yml | 2 +- .github/workflows/skip.yml | 2 +- docs/_index.md | 2 +- poetry.lock | 70 +------------------ pyproject.toml | 10 +-- src/poetry/installation/executor.py | 9 +-- src/poetry/masonry/builders/editable.py | 4 +- src/poetry/repositories/link_sources/base.py | 2 +- src/poetry/repositories/link_sources/html.py | 2 +- src/poetry/repositories/link_sources/json.py | 2 +- src/poetry/utils/_compat.py | 7 -- src/poetry/utils/env.py | 13 ++-- tests/compat.py | 15 ---- tests/plugins/test_plugin_manager.py | 2 +- .../repositories/test_installed_repository.py | 3 +- tests/types.py | 3 +- tests/utils/test_env.py | 1 - 18 files changed, 24 insertions(+), 126 deletions(-) delete mode 100644 tests/compat.py diff --git a/.cirrus.yml b/.cirrus.yml index 2ce67499911..c4722b3ba3e 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -12,7 +12,6 @@ test_task: # avoid failures on tests that depend on it. SHELL: sh matrix: - - PYTHON: python3.7 - PYTHON: python3.8 - PYTHON: python3.9 - PYTHON: python3.10 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index df018e67b32..23508592e2c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: strategy: matrix: os: [Ubuntu, macOS, Windows] - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11"] include: - os: Ubuntu image: ubuntu-22.04 diff --git a/.github/workflows/skip.yml b/.github/workflows/skip.yml index be69a320bbb..599009dc3ef 100644 --- a/.github/workflows/skip.yml +++ b/.github/workflows/skip.yml @@ -28,6 +28,6 @@ jobs: strategy: matrix: os: [Ubuntu, macOS, Windows] - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - run: exit 0 diff --git a/docs/_index.md b/docs/_index.md index ebe15c88b62..329dfdbe99f 100644 --- a/docs/_index.md +++ b/docs/_index.md @@ -18,7 +18,7 @@ Poetry offers a lockfile to ensure repeatable installs, and can build your proje ## System requirements -Poetry requires **Python 3.7+**. It is multi-platform and the goal is to make it work equally well +Poetry requires **Python 3.8+**. It is multi-platform and the goal is to make it work equally well on Linux, macOS and Windows. ## Installation diff --git a/poetry.lock b/poetry.lock index 53cea61ff9c..f015cd05d51 100644 --- a/poetry.lock +++ b/poetry.lock @@ -22,18 +22,6 @@ docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib- tests = ["attrs[tests-no-zope]", "zope-interface"] tests-no-zope = ["cloudpickle", "hypothesis", "mypy (>=1.1.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] -[[package]] -name = "backports-cached-property" -version = "1.0.2" -description = "cached_property() - computed once per instance, cached as attribute" -category = "main" -optional = false -python-versions = ">=3.6.0" -files = [ - {file = "backports.cached-property-1.0.2.tar.gz", hash = "sha256:9306f9eed6ec55fd156ace6bc1094e2c86fae5fb2bf07b6a9c00745c656e75dd"}, - {file = "backports.cached_property-1.0.2-py3-none-any.whl", hash = "sha256:baeb28e1cd619a3c9ab8941431fe34e8490861fb998c6c4590693d50171db0cc"}, -] - [[package]] name = "build" version = "0.10.0" @@ -48,7 +36,6 @@ files = [ [package.dependencies] colorama = {version = "*", markers = "os_name == \"nt\""} -importlib-metadata = {version = ">=0.22", markers = "python_version < \"3.8\""} packaging = ">=19.0" pyproject_hooks = "*" tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} @@ -530,7 +517,6 @@ files = [ ] [package.dependencies] -typing-extensions = {version = "*", markers = "python_version <= \"3.7\""} urllib3 = ">=1.25" [package.extras] @@ -658,7 +644,6 @@ files = [ ] [package.dependencies] -typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} zipp = ">=0.5" [package.extras] @@ -758,11 +743,9 @@ files = [ [package.dependencies] attrs = ">=17.4.0" -importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} importlib-resources = {version = ">=1.4.0", markers = "python_version < \"3.9\""} pkgutil-resolve-name = {version = ">=1.3.10", markers = "python_version < \"3.9\""} pyrsistent = ">=0.14.0,<0.17.0 || >0.17.0,<0.17.1 || >0.17.1,<0.17.2 || >0.17.2" -typing-extensions = {version = "*", markers = "python_version < \"3.8\""} [package.extras] format = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339-validator", "rfc3987", "uri-template", "webcolors (>=1.11)"] @@ -929,7 +912,6 @@ files = [ [package.dependencies] mypy-extensions = ">=1.0.0" tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} -typed-ast = {version = ">=1.4.0,<2", markers = "python_version < \"3.8\""} typing-extensions = ">=3.10" [package.extras] @@ -1046,9 +1028,6 @@ files = [ {file = "platformdirs-3.5.1.tar.gz", hash = "sha256:412dae91f52a6f84830f39a8078cecd0e866cb72294a5c66808e74d5e88d251f"}, ] -[package.dependencies] -typing-extensions = {version = ">=4.5", markers = "python_version < \"3.8\""} - [package.extras] docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.2.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] @@ -1065,9 +1044,6 @@ files = [ {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, ] -[package.dependencies] -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} - [package.extras] dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] @@ -1084,9 +1060,6 @@ files = [ {file = "poetry_core-1.6.0.tar.gz", hash = "sha256:a9c7296a12d6c8e4f8aa50a66ef3c967b2b50fba634da144d358e676fad9989f"}, ] -[package.dependencies] -importlib-metadata = {version = ">=1.7.0", markers = "python_version < \"3.8\""} - [[package]] name = "poetry-plugin-export" version = "1.3.1" @@ -1118,7 +1091,6 @@ files = [ [package.dependencies] cfgv = ">=2.0.0" identify = ">=1.0.0" -importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} nodeenv = ">=0.11.1" pyyaml = ">=5.1" virtualenv = ">=20.10.0" @@ -1241,7 +1213,6 @@ files = [ [package.dependencies] colorama = {version = "*", markers = "sys_platform == \"win32\""} exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} iniconfig = "*" packaging = "*" pluggy = ">=0.12,<2.0" @@ -1637,40 +1608,6 @@ files = [ {file = "trove_classifiers-2023.5.2-py3-none-any.whl", hash = "sha256:0f3eceb7d16186211bcd7edafc7b7934399f738ed985998e4e557e52fe136a71"}, ] -[[package]] -name = "typed-ast" -version = "1.5.4" -description = "a fork of Python 2 and 3 ast modules with type comment support" -category = "dev" -optional = false -python-versions = ">=3.6" -files = [ - {file = "typed_ast-1.5.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:669dd0c4167f6f2cd9f57041e03c3c2ebf9063d0757dc89f79ba1daa2bfca9d4"}, - {file = "typed_ast-1.5.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:211260621ab1cd7324e0798d6be953d00b74e0428382991adfddb352252f1d62"}, - {file = "typed_ast-1.5.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:267e3f78697a6c00c689c03db4876dd1efdfea2f251a5ad6555e82a26847b4ac"}, - {file = "typed_ast-1.5.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:c542eeda69212fa10a7ada75e668876fdec5f856cd3d06829e6aa64ad17c8dfe"}, - {file = "typed_ast-1.5.4-cp310-cp310-win_amd64.whl", hash = "sha256:a9916d2bb8865f973824fb47436fa45e1ebf2efd920f2b9f99342cb7fab93f72"}, - {file = "typed_ast-1.5.4-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:79b1e0869db7c830ba6a981d58711c88b6677506e648496b1f64ac7d15633aec"}, - {file = "typed_ast-1.5.4-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a94d55d142c9265f4ea46fab70977a1944ecae359ae867397757d836ea5a3f47"}, - {file = "typed_ast-1.5.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:183afdf0ec5b1b211724dfef3d2cad2d767cbefac291f24d69b00546c1837fb6"}, - {file = "typed_ast-1.5.4-cp36-cp36m-win_amd64.whl", hash = "sha256:639c5f0b21776605dd6c9dbe592d5228f021404dafd377e2b7ac046b0349b1a1"}, - {file = "typed_ast-1.5.4-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:cf4afcfac006ece570e32d6fa90ab74a17245b83dfd6655a6f68568098345ff6"}, - {file = "typed_ast-1.5.4-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ed855bbe3eb3715fca349c80174cfcfd699c2f9de574d40527b8429acae23a66"}, - {file = "typed_ast-1.5.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:6778e1b2f81dfc7bc58e4b259363b83d2e509a65198e85d5700dfae4c6c8ff1c"}, - {file = "typed_ast-1.5.4-cp37-cp37m-win_amd64.whl", hash = "sha256:0261195c2062caf107831e92a76764c81227dae162c4f75192c0d489faf751a2"}, - {file = "typed_ast-1.5.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:2efae9db7a8c05ad5547d522e7dbe62c83d838d3906a3716d1478b6c1d61388d"}, - {file = "typed_ast-1.5.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7d5d014b7daa8b0bf2eaef684295acae12b036d79f54178b92a2b6a56f92278f"}, - {file = "typed_ast-1.5.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:370788a63915e82fd6f212865a596a0fefcbb7d408bbbb13dea723d971ed8bdc"}, - {file = "typed_ast-1.5.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:4e964b4ff86550a7a7d56345c7864b18f403f5bd7380edf44a3c1fb4ee7ac6c6"}, - {file = "typed_ast-1.5.4-cp38-cp38-win_amd64.whl", hash = "sha256:683407d92dc953c8a7347119596f0b0e6c55eb98ebebd9b23437501b28dcbb8e"}, - {file = "typed_ast-1.5.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:4879da6c9b73443f97e731b617184a596ac1235fe91f98d279a7af36c796da35"}, - {file = "typed_ast-1.5.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3e123d878ba170397916557d31c8f589951e353cc95fb7f24f6bb69adc1a8a97"}, - {file = "typed_ast-1.5.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ebd9d7f80ccf7a82ac5f88c521115cc55d84e35bf8b446fcd7836eb6b98929a3"}, - {file = "typed_ast-1.5.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:98f80dee3c03455e92796b58b98ff6ca0b2a6f652120c263efdba4d6c5e58f72"}, - {file = "typed_ast-1.5.4-cp39-cp39-win_amd64.whl", hash = "sha256:0fdbcf2fef0ca421a3f5912555804296f0b0960f0418c440f5d6d3abb549f3e1"}, - {file = "typed_ast-1.5.4.tar.gz", hash = "sha256:39e21ceb7388e4bb37f4c679d72707ed46c2fbf2a5609b8b8ebc4b067d977df2"}, -] - [[package]] name = "types-html5lib" version = "1.1.11.14" @@ -1726,7 +1663,7 @@ files = [ name = "typing-extensions" version = "4.5.0" description = "Backported and Experimental Type Hints for Python 3.7+" -category = "main" +category = "dev" optional = false python-versions = ">=3.7" files = [ @@ -1766,7 +1703,6 @@ files = [ [package.dependencies] distlib = ">=0.3.6,<1" filelock = ">=3.11,<4" -importlib-metadata = {version = ">=6.4.1", markers = "python_version < \"3.8\""} platformdirs = ">=3.2,<4" [package.extras] @@ -1888,5 +1824,5 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more [metadata] lock-version = "2.0" -python-versions = "^3.7" -content-hash = "88510d026496be61125bc3157ece9584978ce58bf42fb551ca6d03066b8d8c61" +python-versions = "^3.8" +content-hash = "0eccb38c0af361232f1dadebed6e98fdd7e4c9f7238accf0c634121af0afcb88" diff --git a/pyproject.toml b/pyproject.toml index d3a49c61d3d..894488b1db8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,11 +30,10 @@ Changelog = "https://python-poetry.org/history/" # Requirements [tool.poetry.dependencies] -python = "^3.7" +python = "^3.8" poetry-core = "1.6.0" poetry-plugin-export = "^1.3.1" -"backports.cached-property" = { version = "^1.0.2", python = "<3.8" } build = "^0.10.0" cachecontrol = { version = "^0.12.9", extras = ["filecache"] } cleo = "^2.0.0" @@ -77,14 +76,12 @@ pytest-cov = "^4.0" pytest-mock = "^3.9" pytest-randomly = "^3.12" pytest-xdist = { version = "^3.1", extras = ["psutil"] } -zipp = { version = "^3.4", python = "<3.8" } [tool.poetry.group.typing.dependencies] mypy = ">=1.0" types-html5lib = ">=1.1.9" types-jsonschema = ">=4.9.0" types-requests = ">=2.28.8" -typing-extensions = { version = "^4.0.0", python = "<3.8" } # only used in github actions [tool.poetry.group.github-actions] @@ -106,7 +103,7 @@ fix = true unfixable = [ "ERA", # do not autoremove commented out code ] -target-version = "py37" +target-version = "py38" line-length = 88 extend-select = [ "B", # flake8-bugbear @@ -146,9 +143,8 @@ known-first-party = ["poetry"] known-third-party = ["poetry.core"] required-imports = ["from __future__ import annotations"] - [tool.black] -target-version = ['py37'] +target-version = ['py38'] preview = true force-exclude = ''' .*/setup\.py$ diff --git a/src/poetry/installation/executor.py b/src/poetry/installation/executor.py index a46ee04a32c..8e2eecf5221 100644 --- a/src/poetry/installation/executor.py +++ b/src/poetry/installation/executor.py @@ -766,10 +766,7 @@ def _download_link(self, operation: Install | Update, link: Link) -> Path: link ) cached_file = cache_directory.joinpath(link.filename) - # We can't use unlink(missing_ok=True) because it's not available - # prior to Python 3.8 - if cached_file.exists(): - cached_file.unlink() + cached_file.unlink(missing_ok=True) raise @@ -897,9 +894,7 @@ def _save_url_reference(self, operation: Operation) -> None: ) in self._env.site_packages.find_distribution_direct_url_json_files( distribution_name=package.name, writable_only=True ): - # We can't use unlink(missing_ok=True) because it's not always available - if direct_url_json.exists(): - direct_url_json.unlink() + direct_url_json.unlink(missing_ok=True) return url_reference: dict[str, Any] | None = None diff --git a/src/poetry/masonry/builders/editable.py b/src/poetry/masonry/builders/editable.py index 7eb438ad3c8..799e93a346c 100644 --- a/src/poetry/masonry/builders/editable.py +++ b/src/poetry/masonry/builders/editable.py @@ -132,9 +132,7 @@ def _add_pth(self) -> list[Path]: f" - Removing existing {file.name} from {file.parent}" f" for {self._poetry.file.path.parent}" ) - # We can't use unlink(missing_ok=True) because it's not always available - if file.exists(): - file.unlink() + file.unlink(missing_ok=True) try: pth_file = self._env.site_packages.write_text( diff --git a/src/poetry/repositories/link_sources/base.py b/src/poetry/repositories/link_sources/base.py index 975553eec40..b2bd455d42a 100644 --- a/src/poetry/repositories/link_sources/base.py +++ b/src/poetry/repositories/link_sources/base.py @@ -3,6 +3,7 @@ import logging import re +from functools import cached_property from typing import TYPE_CHECKING from typing import DefaultDict from typing import List @@ -11,7 +12,6 @@ from poetry.core.packages.package import Package from poetry.core.version.exceptions import InvalidVersion -from poetry.utils._compat import cached_property from poetry.utils.patterns import sdist_file_re from poetry.utils.patterns import wheel_file_re diff --git a/src/poetry/repositories/link_sources/html.py b/src/poetry/repositories/link_sources/html.py index 5ea4eff78d0..54ade20a664 100644 --- a/src/poetry/repositories/link_sources/html.py +++ b/src/poetry/repositories/link_sources/html.py @@ -4,13 +4,13 @@ import warnings from collections import defaultdict +from functools import cached_property from html import unescape from typing import TYPE_CHECKING from poetry.core.packages.utils.link import Link from poetry.repositories.link_sources.base import LinkSource -from poetry.utils._compat import cached_property if TYPE_CHECKING: diff --git a/src/poetry/repositories/link_sources/json.py b/src/poetry/repositories/link_sources/json.py index 0acadd81fb3..12b9c43ade1 100644 --- a/src/poetry/repositories/link_sources/json.py +++ b/src/poetry/repositories/link_sources/json.py @@ -1,13 +1,13 @@ from __future__ import annotations from collections import defaultdict +from functools import cached_property from typing import TYPE_CHECKING from typing import Any from poetry.core.packages.utils.link import Link from poetry.repositories.link_sources.base import LinkSource -from poetry.utils._compat import cached_property if TYPE_CHECKING: diff --git a/src/poetry/utils/_compat.py b/src/poetry/utils/_compat.py index cf316b58c26..be1194c73d0 100644 --- a/src/poetry/utils/_compat.py +++ b/src/poetry/utils/_compat.py @@ -21,12 +21,6 @@ else: from importlib import metadata -if sys.version_info < (3, 8): - # compatibility for python <3.8 - from backports.cached_property import cached_property -else: - from functools import cached_property - WINDOWS = sys.platform == "win32" @@ -58,7 +52,6 @@ def encode(string: str, encodings: list[str] | None = None) -> bytes: __all__ = [ "WINDOWS", - "cached_property", "decode", "encode", "metadata", diff --git a/src/poetry/utils/env.py b/src/poetry/utils/env.py index 4cd3acfab75..007d386398b 100644 --- a/src/poetry/utils/env.py +++ b/src/poetry/utils/env.py @@ -338,10 +338,7 @@ def remove_distribution_files(self, distribution_name: str) -> list[Path]: files = [] if distribution.files is None else distribution.files for file in files: path = Path(distribution.locate_file(file)) - - # We can't use unlink(missing_ok=True) because it's not always available - if path.exists(): - path.unlink() + path.unlink(missing_ok=True) distribution_path: Path = distribution._path # type: ignore[attr-defined] if distribution_path.exists(): @@ -544,7 +541,7 @@ def get_python_version( if executable: python_patch = decode( subprocess.check_output( - [str(executable), "-c", GET_PYTHON_VERSION_ONELINER], + [executable, "-c", GET_PYTHON_VERSION_ONELINER], ).strip() ) @@ -579,7 +576,7 @@ def activate(self, python: str) -> Env: try: python_version_string = decode( subprocess.check_output( - [str(python_path), "-c", GET_PYTHON_VERSION_ONELINER], + [python_path, "-c", GET_PYTHON_VERSION_ONELINER], ) ) except CalledProcessError as e: @@ -906,7 +903,7 @@ def create_venv( if executable: python_patch = decode( subprocess.check_output( - [str(executable), "-c", GET_PYTHON_VERSION_ONELINER], + [executable, "-c", GET_PYTHON_VERSION_ONELINER], ).strip() ) python_minor = ".".join(python_patch.split(".")[:2]) @@ -954,7 +951,7 @@ def create_venv( try: python_patch = decode( subprocess.check_output( - [str(python), "-c", GET_PYTHON_VERSION_ONELINER], + [python, "-c", GET_PYTHON_VERSION_ONELINER], stderr=subprocess.STDOUT, ).strip() ) diff --git a/tests/compat.py b/tests/compat.py deleted file mode 100644 index a5808d9288b..00000000000 --- a/tests/compat.py +++ /dev/null @@ -1,15 +0,0 @@ -from __future__ import annotations - -import sys - - -if sys.version_info < (3, 8): - import zipp as zipfile # nopycln: import - - from typing_extensions import Protocol # nopycln: import -else: - import zipfile - - from typing import Protocol - -__all__ = ["zipfile", "Protocol"] diff --git a/tests/plugins/test_plugin_manager.py b/tests/plugins/test_plugin_manager.py index 6512f248fb8..7ac296b8ef9 100644 --- a/tests/plugins/test_plugin_manager.py +++ b/tests/plugins/test_plugin_manager.py @@ -2,6 +2,7 @@ from pathlib import Path from typing import TYPE_CHECKING +from typing import Protocol import pytest @@ -14,7 +15,6 @@ from poetry.plugins import Plugin from poetry.plugins.plugin_manager import PluginManager from poetry.poetry import Poetry -from tests.compat import Protocol from tests.helpers import mock_metadata_entry_points diff --git a/tests/repositories/test_installed_repository.py b/tests/repositories/test_installed_repository.py index ae54d94ba24..b69df38b6f4 100644 --- a/tests/repositories/test_installed_repository.py +++ b/tests/repositories/test_installed_repository.py @@ -1,5 +1,7 @@ from __future__ import annotations +import zipfile + from pathlib import Path from typing import TYPE_CHECKING from typing import NamedTuple @@ -9,7 +11,6 @@ from poetry.repositories.installed_repository import InstalledRepository from poetry.utils._compat import metadata from poetry.utils.env import MockEnv as BaseMockEnv -from tests.compat import zipfile if TYPE_CHECKING: diff --git a/tests/types.py b/tests/types.py index 5cc9ea5bf24..75f589d38d6 100644 --- a/tests/types.py +++ b/tests/types.py @@ -2,8 +2,7 @@ from typing import TYPE_CHECKING from typing import Any - -from tests.compat import Protocol +from typing import Protocol if TYPE_CHECKING: diff --git a/tests/utils/test_env.py b/tests/utils/test_env.py index f66f57482f8..2022bbbd549 100644 --- a/tests/utils/test_env.py +++ b/tests/utils/test_env.py @@ -192,7 +192,6 @@ def check_output_wrapper( ) -> Callable[[list[str], Any, Any], str]: def check_output(cmd: list[str], *args: Any, **kwargs: Any) -> str: # cmd is a list, like ["python", "-c", "do stuff"] - assert all(isinstance(arg, str) for arg in cmd) python_cmd = cmd[2] if "sys.version_info[:3]" in python_cmd: return version.text