diff --git a/news/12974.trivial.rst b/news/12974.trivial.rst new file mode 100644 index 00000000000..d1c31fb177a --- /dev/null +++ b/news/12974.trivial.rst @@ -0,0 +1 @@ +Create two new import groups, "vendored" and "import", this only affects tests. diff --git a/pyproject.toml b/pyproject.toml index 4d8d1181697..fa29a9cb020 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -185,9 +185,19 @@ select = [ ] [tool.ruff.lint.isort] -# Explicitly make tests "first party" as it's not in the "src" directory -known-first-party = ["tests"] -known-third-party = ["pip._vendor"] +section-order = [ + "future", + "standard-library", + "third-party", + "vendored", + "first-party", + "tests", + "local-folder", +] + +[tool.ruff.lint.isort.sections] +"vendored" = ["pip._vendor"] +"tests" = ["tests"] [tool.ruff.lint.mccabe] max-complexity = 33 # default is 10 diff --git a/tests/conftest.py b/tests/conftest.py index da4ab5b9dfb..d093eea462b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -47,6 +47,7 @@ from pip import __file__ as pip_location from pip._internal.locations import _USE_SYSCONFIG from pip._internal.utils.temp_dir import global_tempdir_manager + from tests.lib import ( DATA_DIR, SRC_DIR, diff --git a/tests/functional/test_build_env.py b/tests/functional/test_build_env.py index 11164be0500..c950a8a6de9 100644 --- a/tests/functional/test_build_env.py +++ b/tests/functional/test_build_env.py @@ -6,6 +6,7 @@ import pytest from pip._internal.build_env import BuildEnvironment, _get_system_sitepackages + from tests.lib import ( PipTestEnvironment, TestPipResult, diff --git a/tests/functional/test_cli.py b/tests/functional/test_cli.py index e1ccf04ea1c..5be66d88eac 100644 --- a/tests/functional/test_cli.py +++ b/tests/functional/test_cli.py @@ -9,6 +9,7 @@ import pytest from pip._internal.commands import commands_dict + from tests.lib import PipTestEnvironment diff --git a/tests/functional/test_config_settings.py b/tests/functional/test_config_settings.py index 857722dd10d..4e0b12ca185 100644 --- a/tests/functional/test_config_settings.py +++ b/tests/functional/test_config_settings.py @@ -5,6 +5,7 @@ from zipfile import ZipFile from pip._internal.utils.urls import path_to_url + from tests.lib import PipTestEnvironment, create_basic_sdist_for_package PYPROJECT_TOML = """\ diff --git a/tests/functional/test_configuration.py b/tests/functional/test_configuration.py index 854fb3694b1..56cac572c4f 100644 --- a/tests/functional/test_configuration.py +++ b/tests/functional/test_configuration.py @@ -6,6 +6,7 @@ from pip._internal.cli.status_codes import ERROR from pip._internal.configuration import CONFIG_BASENAME, get_configuration_files + from tests.lib import PipTestEnvironment from tests.lib.configuration_helpers import ConfigurationMixin, kinds from tests.lib.venv import VirtualEnvironment diff --git a/tests/functional/test_debug.py b/tests/functional/test_debug.py index 77d4bea335f..82557299904 100644 --- a/tests/functional/test_debug.py +++ b/tests/functional/test_debug.py @@ -2,10 +2,12 @@ from typing import List import pytest + from pip._vendor.packaging.version import Version from pip._internal.commands.debug import create_vendor_txt_map from pip._internal.utils import compatibility_tags + from tests.lib import PipTestEnvironment diff --git a/tests/functional/test_download.py b/tests/functional/test_download.py index d469e71c360..3906885a19b 100644 --- a/tests/functional/test_download.py +++ b/tests/functional/test_download.py @@ -11,6 +11,7 @@ from pip._internal.cli.status_codes import ERROR from pip._internal.utils.urls import path_to_url + from tests.lib import ( PipTestEnvironment, ScriptFactory, diff --git a/tests/functional/test_fast_deps.py b/tests/functional/test_fast_deps.py index 5a910b89763..85c9bbd7072 100644 --- a/tests/functional/test_fast_deps.py +++ b/tests/functional/test_fast_deps.py @@ -7,9 +7,11 @@ from typing import Iterable import pytest + from pip._vendor.packaging.utils import canonicalize_name from pip._internal.utils.misc import hash_file + from tests.lib import PipTestEnvironment, TestData, TestPipResult diff --git a/tests/functional/test_freeze.py b/tests/functional/test_freeze.py index b7af974ea61..0a7cedd11cb 100644 --- a/tests/functional/test_freeze.py +++ b/tests/functional/test_freeze.py @@ -6,9 +6,11 @@ from pathlib import Path import pytest + from pip._vendor.packaging.utils import canonicalize_name from pip._internal.models.direct_url import DirectUrl, DirInfo + from tests.lib import ( PipTestEnvironment, TestData, diff --git a/tests/functional/test_help.py b/tests/functional/test_help.py index 75414214a93..cba036927c8 100644 --- a/tests/functional/test_help.py +++ b/tests/functional/test_help.py @@ -5,6 +5,7 @@ from pip._internal.cli.status_codes import ERROR, SUCCESS from pip._internal.commands import commands_dict, create_command from pip._internal.exceptions import CommandError + from tests.lib import InMemoryPip, PipTestEnvironment diff --git a/tests/functional/test_index.py b/tests/functional/test_index.py index 43b8f09c311..5a3c27bac9d 100644 --- a/tests/functional/test_index.py +++ b/tests/functional/test_index.py @@ -2,6 +2,7 @@ from pip._internal.cli.status_codes import ERROR, SUCCESS from pip._internal.commands import create_command + from tests.lib import PipTestEnvironment diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index 8c30a69b515..4718beb948c 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -17,6 +17,7 @@ from pip._internal.models.index import PyPI, TestPyPI from pip._internal.utils.misc import rmtree from pip._internal.utils.urls import path_to_url + from tests.lib import ( CertFactory, PipTestEnvironment, diff --git a/tests/functional/test_install_direct_url.py b/tests/functional/test_install_direct_url.py index 139ef178e77..5aefab09cb3 100644 --- a/tests/functional/test_install_direct_url.py +++ b/tests/functional/test_install_direct_url.py @@ -1,6 +1,7 @@ import pytest from pip._internal.models.direct_url import VcsInfo + from tests.lib import PipTestEnvironment, TestData, _create_test_package from tests.lib.direct_url import get_created_direct_url diff --git a/tests/functional/test_invalid_versions_and_specifiers.py b/tests/functional/test_invalid_versions_and_specifiers.py index 4867fe54beb..6349036bf52 100644 --- a/tests/functional/test_invalid_versions_and_specifiers.py +++ b/tests/functional/test_invalid_versions_and_specifiers.py @@ -3,6 +3,7 @@ import pytest from pip._internal.metadata import select_backend + from tests.lib import PipTestEnvironment, TestData diff --git a/tests/functional/test_list.py b/tests/functional/test_list.py index 43998600eb6..e611fe7cb64 100644 --- a/tests/functional/test_list.py +++ b/tests/functional/test_list.py @@ -5,6 +5,7 @@ import pytest from pip._internal.models.direct_url import DirectUrl, DirInfo + from tests.lib import ( PipTestEnvironment, ScriptFactory, diff --git a/tests/functional/test_new_resolver_target.py b/tests/functional/test_new_resolver_target.py index 4434c276fca..58b2d548b65 100644 --- a/tests/functional/test_new_resolver_target.py +++ b/tests/functional/test_new_resolver_target.py @@ -4,6 +4,7 @@ import pytest from pip._internal.cli.status_codes import ERROR, SUCCESS + from tests.lib import PipTestEnvironment from tests.lib.wheel import make_wheel diff --git a/tests/functional/test_pep517.py b/tests/functional/test_pep517.py index 4e0c16358af..fd9380d0eb6 100644 --- a/tests/functional/test_pep517.py +++ b/tests/functional/test_pep517.py @@ -7,6 +7,7 @@ from pip._internal.build_env import BuildEnvironment from pip._internal.req import InstallRequirement + from tests.lib import ( PipTestEnvironment, TestData, diff --git a/tests/functional/test_pip_runner_script.py b/tests/functional/test_pip_runner_script.py index f2f879b824d..ba73f936321 100644 --- a/tests/functional/test_pip_runner_script.py +++ b/tests/functional/test_pip_runner_script.py @@ -2,6 +2,7 @@ from pathlib import Path from pip import __version__ + from tests.lib import PipTestEnvironment diff --git a/tests/functional/test_search.py b/tests/functional/test_search.py index 3d4baeb4832..9491b492400 100644 --- a/tests/functional/test_search.py +++ b/tests/functional/test_search.py @@ -7,6 +7,7 @@ from pip._internal.cli.status_codes import NO_MATCHES_FOUND, SUCCESS from pip._internal.commands import create_command from pip._internal.commands.search import highest_version, print_results, transform_hits + from tests.lib import PipTestEnvironment if TYPE_CHECKING: diff --git a/tests/functional/test_show.py b/tests/functional/test_show.py index 7797de9e992..4cc1587733f 100644 --- a/tests/functional/test_show.py +++ b/tests/functional/test_show.py @@ -8,6 +8,7 @@ from pip import __version__ from pip._internal.commands.show import search_packages_info from pip._internal.utils.unpacking import untar_file + from tests.lib import ( PipTestEnvironment, TestData, diff --git a/tests/functional/test_uninstall.py b/tests/functional/test_uninstall.py index 58e141e54ad..d86ba172002 100644 --- a/tests/functional/test_uninstall.py +++ b/tests/functional/test_uninstall.py @@ -12,6 +12,7 @@ from pip._internal.req.constructors import install_req_from_line from pip._internal.utils.misc import rmtree + from tests.lib import ( PipTestEnvironment, TestData, diff --git a/tests/functional/test_vcs_bazaar.py b/tests/functional/test_vcs_bazaar.py index 63955d6e701..821427ed841 100644 --- a/tests/functional/test_vcs_bazaar.py +++ b/tests/functional/test_vcs_bazaar.py @@ -10,6 +10,7 @@ from pip._internal.vcs.bazaar import Bazaar from pip._internal.vcs.versioncontrol import RemoteNotFoundError + from tests.lib import PipTestEnvironment, is_bzr_installed, need_bzr diff --git a/tests/functional/test_vcs_git.py b/tests/functional/test_vcs_git.py index a7276e2b6a5..f917fa8b39e 100644 --- a/tests/functional/test_vcs_git.py +++ b/tests/functional/test_vcs_git.py @@ -13,6 +13,7 @@ from pip._internal.utils.misc import HiddenText from pip._internal.vcs import vcs from pip._internal.vcs.git import Git, RemoteNotFoundError + from tests.lib import PipTestEnvironment, _create_test_package, _git_commit diff --git a/tests/functional/test_vcs_mercurial.py b/tests/functional/test_vcs_mercurial.py index 9a909e71f24..a511c40aae2 100644 --- a/tests/functional/test_vcs_mercurial.py +++ b/tests/functional/test_vcs_mercurial.py @@ -1,6 +1,7 @@ import os from pip._internal.vcs.mercurial import Mercurial + from tests.lib import PipTestEnvironment, _create_test_package, need_mercurial diff --git a/tests/functional/test_vcs_subversion.py b/tests/functional/test_vcs_subversion.py index 05c20c7c145..987f481edd4 100644 --- a/tests/functional/test_vcs_subversion.py +++ b/tests/functional/test_vcs_subversion.py @@ -4,6 +4,7 @@ from pip._internal.vcs.subversion import Subversion from pip._internal.vcs.versioncontrol import RemoteNotFoundError + from tests.lib import PipTestEnvironment, _create_svn_repo, need_svn diff --git a/tests/functional/test_wheel.py b/tests/functional/test_wheel.py index 1bddd40dc41..da2bd2d7904 100644 --- a/tests/functional/test_wheel.py +++ b/tests/functional/test_wheel.py @@ -8,6 +8,7 @@ import pytest from pip._internal.cli.status_codes import ERROR + from tests.lib import ( PipTestEnvironment, TestData, diff --git a/tests/lib/__init__.py b/tests/lib/__init__.py index e318f7155d2..df142ba4438 100644 --- a/tests/lib/__init__.py +++ b/tests/lib/__init__.py @@ -32,9 +32,10 @@ from zipfile import ZipFile import pytest -from pip._vendor.packaging.utils import canonicalize_name from scripttest import FoundDir, FoundFile, ProcResult, TestFileEnvironment +from pip._vendor.packaging.utils import canonicalize_name + from pip._internal.cli.main import main as pip_entry_point from pip._internal.index.collector import LinkCollector from pip._internal.index.package_finder import PackageFinder @@ -44,6 +45,7 @@ from pip._internal.models.target_python import TargetPython from pip._internal.network.session import PipSession from pip._internal.utils.egg_link import _egg_link_names + from tests.lib.venv import VirtualEnvironment from tests.lib.wheel import make_wheel diff --git a/tests/lib/direct_url.py b/tests/lib/direct_url.py index e0dac032062..fff1ae966cd 100644 --- a/tests/lib/direct_url.py +++ b/tests/lib/direct_url.py @@ -4,6 +4,7 @@ from typing import Optional from pip._internal.models.direct_url import DIRECT_URL_METADATA_NAME, DirectUrl + from tests.lib import TestPipResult diff --git a/tests/unit/metadata/test_metadata.py b/tests/unit/metadata/test_metadata.py index caa2dea8c91..404d858bdd5 100644 --- a/tests/unit/metadata/test_metadata.py +++ b/tests/unit/metadata/test_metadata.py @@ -5,6 +5,7 @@ from unittest import mock import pytest + from pip._vendor.packaging.utils import NormalizedName from pip._internal.metadata import ( @@ -15,6 +16,7 @@ ) from pip._internal.metadata.base import FilesystemWheel from pip._internal.models.direct_url import DIRECT_URL_METADATA_NAME, ArchiveInfo + from tests.lib.wheel import make_wheel diff --git a/tests/unit/metadata/test_metadata_pkg_resources.py b/tests/unit/metadata/test_metadata_pkg_resources.py index 6044c14e4ca..6b3a302fb3c 100644 --- a/tests/unit/metadata/test_metadata_pkg_resources.py +++ b/tests/unit/metadata/test_metadata_pkg_resources.py @@ -4,6 +4,7 @@ from unittest import mock import pytest + from pip._vendor.packaging.requirements import Requirement from pip._vendor.packaging.specifiers import SpecifierSet from pip._vendor.packaging.utils import canonicalize_name diff --git a/tests/unit/resolution_resolvelib/conftest.py b/tests/unit/resolution_resolvelib/conftest.py index 348396bafe2..6aa5f505dbb 100644 --- a/tests/unit/resolution_resolvelib/conftest.py +++ b/tests/unit/resolution_resolvelib/conftest.py @@ -17,6 +17,7 @@ from pip._internal.resolution.resolvelib.factory import Factory from pip._internal.resolution.resolvelib.provider import PipProvider from pip._internal.utils.temp_dir import TempDirectory, global_tempdir_manager + from tests.lib import TestData diff --git a/tests/unit/resolution_resolvelib/test_requirement.py b/tests/unit/resolution_resolvelib/test_requirement.py index 436081b1d8f..cde6256a206 100644 --- a/tests/unit/resolution_resolvelib/test_requirement.py +++ b/tests/unit/resolution_resolvelib/test_requirement.py @@ -3,11 +3,13 @@ from typing import List, Tuple import pytest + from pip._vendor.resolvelib import BaseReporter, Resolver from pip._internal.resolution.resolvelib.base import Candidate, Constraint, Requirement from pip._internal.resolution.resolvelib.factory import Factory from pip._internal.resolution.resolvelib.provider import PipProvider + from tests.lib import TestData # NOTE: All tests are prefixed `test_rlr` (for "test resolvelib resolver"). diff --git a/tests/unit/resolution_resolvelib/test_resolver.py b/tests/unit/resolution_resolvelib/test_resolver.py index f2f36770fe6..18238eef134 100644 --- a/tests/unit/resolution_resolvelib/test_resolver.py +++ b/tests/unit/resolution_resolvelib/test_resolver.py @@ -2,6 +2,7 @@ from unittest import mock import pytest + from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.resolvelib.resolvers import Result from pip._vendor.resolvelib.structs import DirectedGraph diff --git a/tests/unit/test_appdirs.py b/tests/unit/test_appdirs.py index fd3ea143bcb..6e6521dd5c0 100644 --- a/tests/unit/test_appdirs.py +++ b/tests/unit/test_appdirs.py @@ -5,6 +5,7 @@ from unittest import mock import pytest + from pip._vendor import platformdirs from pip._internal.utils import appdirs diff --git a/tests/unit/test_collector.py b/tests/unit/test_collector.py index 882f82ae4fe..c527d5610a3 100644 --- a/tests/unit/test_collector.py +++ b/tests/unit/test_collector.py @@ -10,6 +10,7 @@ from unittest import mock import pytest + from pip._vendor import requests from pip._vendor.packaging.requirements import Requirement @@ -35,6 +36,7 @@ _ensure_quoted_url, ) from pip._internal.network.session import PipSession + from tests.lib import ( TestData, make_test_link_collector, diff --git a/tests/unit/test_configuration.py b/tests/unit/test_configuration.py index 1a0acb7b411..29a268c7875 100644 --- a/tests/unit/test_configuration.py +++ b/tests/unit/test_configuration.py @@ -8,6 +8,7 @@ from pip._internal.configuration import get_configuration_files, kinds from pip._internal.exceptions import ConfigurationError + from tests.lib.configuration_helpers import ConfigurationMixin diff --git a/tests/unit/test_exceptions.py b/tests/unit/test_exceptions.py index 12a17dcd1f3..90a44348f0a 100644 --- a/tests/unit/test_exceptions.py +++ b/tests/unit/test_exceptions.py @@ -9,6 +9,7 @@ from typing import Optional, Tuple import pytest + from pip._vendor import rich from pip._internal.exceptions import DiagnosticPipError, ExternallyManagedEnvironment diff --git a/tests/unit/test_finder.py b/tests/unit/test_finder.py index 35c7e89b765..8c923dcd36f 100644 --- a/tests/unit/test_finder.py +++ b/tests/unit/test_finder.py @@ -3,6 +3,7 @@ from unittest.mock import Mock, patch import pytest + from pip._vendor.packaging.specifiers import SpecifierSet from pip._vendor.packaging.tags import Tag from pip._vendor.packaging.version import parse as parse_version @@ -18,6 +19,7 @@ ) from pip._internal.models.target_python import TargetPython from pip._internal.req.constructors import install_req_from_line + from tests.lib import TestData, make_test_finder diff --git a/tests/unit/test_index.py b/tests/unit/test_index.py index d02c70b260e..8faa4a56a0a 100644 --- a/tests/unit/test_index.py +++ b/tests/unit/test_index.py @@ -2,6 +2,7 @@ from typing import FrozenSet, List, Optional, Set, Tuple import pytest + from pip._vendor.packaging.specifiers import SpecifierSet from pip._vendor.packaging.tags import Tag @@ -25,6 +26,7 @@ from pip._internal.network.session import PipSession from pip._internal.utils.compatibility_tags import get_supported from pip._internal.utils.hashes import Hashes + from tests.lib import CURRENT_PY_VERSION_INFO from tests.lib.index import make_mock_candidate diff --git a/tests/unit/test_models_wheel.py b/tests/unit/test_models_wheel.py index ee4d88c744a..3156a3ff4bc 100644 --- a/tests/unit/test_models_wheel.py +++ b/tests/unit/test_models_wheel.py @@ -1,4 +1,5 @@ import pytest + from pip._vendor.packaging.tags import Tag from pip._internal.exceptions import InvalidWheelFilename diff --git a/tests/unit/test_network_auth.py b/tests/unit/test_network_auth.py index 86f01e436c0..aec5e513ba5 100644 --- a/tests/unit/test_network_auth.py +++ b/tests/unit/test_network_auth.py @@ -8,6 +8,7 @@ import pip._internal.network.auth from pip._internal.network.auth import MultiDomainBasicAuth + from tests.lib.requests_mocks import MockConnection, MockRequest, MockResponse diff --git a/tests/unit/test_network_cache.py b/tests/unit/test_network_cache.py index b43b36cd897..6bba8fc670b 100644 --- a/tests/unit/test_network_cache.py +++ b/tests/unit/test_network_cache.py @@ -3,9 +3,11 @@ from unittest.mock import Mock import pytest + from pip._vendor.cachecontrol.caches import FileCache from pip._internal.network.cache import SafeFileCache + from tests.lib.filesystem import chmod diff --git a/tests/unit/test_network_download.py b/tests/unit/test_network_download.py index 53200f2e511..14998d229bf 100644 --- a/tests/unit/test_network_download.py +++ b/tests/unit/test_network_download.py @@ -10,6 +10,7 @@ parse_content_disposition, sanitize_content_filename, ) + from tests.lib.requests_mocks import MockResponse diff --git a/tests/unit/test_network_lazy_wheel.py b/tests/unit/test_network_lazy_wheel.py index 356387d2bba..5d97e9e3202 100644 --- a/tests/unit/test_network_lazy_wheel.py +++ b/tests/unit/test_network_lazy_wheel.py @@ -1,6 +1,7 @@ from typing import Iterator import pytest + from pip._vendor.packaging.version import Version from pip._internal.exceptions import InvalidWheel @@ -9,6 +10,7 @@ dist_from_wheel_url, ) from pip._internal.network.session import PipSession + from tests.lib import TestData from tests.lib.server import MockServer, file_response diff --git a/tests/unit/test_network_session.py b/tests/unit/test_network_session.py index 3f1a596ad8e..fd00d5c606c 100644 --- a/tests/unit/test_network_session.py +++ b/tests/unit/test_network_session.py @@ -6,6 +6,7 @@ from urllib.request import getproxies import pytest + from pip._vendor import requests from pip import __version__ diff --git a/tests/unit/test_network_utils.py b/tests/unit/test_network_utils.py index 1b198c166fc..5911583feec 100644 --- a/tests/unit/test_network_utils.py +++ b/tests/unit/test_network_utils.py @@ -2,6 +2,7 @@ from pip._internal.exceptions import NetworkConnectionError from pip._internal.network.utils import raise_for_status + from tests.lib.requests_mocks import MockResponse diff --git a/tests/unit/test_operations_prepare.py b/tests/unit/test_operations_prepare.py index d06733e8503..86e26c11801 100644 --- a/tests/unit/test_operations_prepare.py +++ b/tests/unit/test_operations_prepare.py @@ -14,6 +14,7 @@ from pip._internal.network.session import PipSession from pip._internal.operations.prepare import unpack_url from pip._internal.utils.hashes import Hashes + from tests.lib import TestData from tests.lib.requests_mocks import MockResponse diff --git a/tests/unit/test_options.py b/tests/unit/test_options.py index aee64ccc932..8f3cf7de6a6 100644 --- a/tests/unit/test_options.py +++ b/tests/unit/test_options.py @@ -11,6 +11,7 @@ from pip._internal.commands import create_command from pip._internal.commands.configuration import ConfigurationCommand from pip._internal.exceptions import PipError + from tests.lib.options_helpers import AddFakeCommandMixin diff --git a/tests/unit/test_packaging.py b/tests/unit/test_packaging.py index 88277448c2c..6b8c4cd37d8 100644 --- a/tests/unit/test_packaging.py +++ b/tests/unit/test_packaging.py @@ -1,6 +1,7 @@ from typing import Optional, Tuple import pytest + from pip._vendor.packaging import specifiers from pip._vendor.packaging.requirements import Requirement diff --git a/tests/unit/test_pep517.py b/tests/unit/test_pep517.py index b9fcd9d2137..4264bbdcac8 100644 --- a/tests/unit/test_pep517.py +++ b/tests/unit/test_pep517.py @@ -7,6 +7,7 @@ from pip._internal.exceptions import InstallationError, InvalidPyProjectBuildRequires from pip._internal.req import InstallRequirement + from tests.lib import TestData diff --git a/tests/unit/test_req.py b/tests/unit/test_req.py index 8a95c058706..e243a718725 100644 --- a/tests/unit/test_req.py +++ b/tests/unit/test_req.py @@ -10,6 +10,7 @@ from unittest import mock import pytest + from pip._vendor.packaging.markers import Marker from pip._vendor.packaging.requirements import Requirement @@ -46,6 +47,7 @@ handle_requirement_line, ) from pip._internal.resolution.legacy.resolver import Resolver + from tests.lib import TestData, make_test_finder, requirements_file, wheel diff --git a/tests/unit/test_req_file.py b/tests/unit/test_req_file.py index 1ddccdee58e..7593e55d679 100644 --- a/tests/unit/test_req_file.py +++ b/tests/unit/test_req_file.py @@ -28,6 +28,7 @@ preprocess, ) from pip._internal.req.req_install import InstallRequirement + from tests.lib import TestData, make_test_finder, requirements_file diff --git a/tests/unit/test_req_install.py b/tests/unit/test_req_install.py index 22b98f86da2..79828525da4 100644 --- a/tests/unit/test_req_install.py +++ b/tests/unit/test_req_install.py @@ -3,6 +3,7 @@ from pathlib import Path import pytest + from pip._vendor.packaging.requirements import Requirement from pip._internal.exceptions import InstallationError diff --git a/tests/unit/test_req_uninstall.py b/tests/unit/test_req_uninstall.py index 0523ffd7a07..0372eac9bd9 100644 --- a/tests/unit/test_req_uninstall.py +++ b/tests/unit/test_req_uninstall.py @@ -16,6 +16,7 @@ compress_for_rename, uninstallation_paths, ) + from tests.lib import create_file diff --git a/tests/unit/test_resolution_legacy_resolver.py b/tests/unit/test_resolution_legacy_resolver.py index b2f93b3d4f5..489f678c561 100644 --- a/tests/unit/test_resolution_legacy_resolver.py +++ b/tests/unit/test_resolution_legacy_resolver.py @@ -5,6 +5,7 @@ from unittest import mock import pytest + from pip._vendor.packaging.specifiers import SpecifierSet from pip._vendor.packaging.utils import NormalizedName @@ -21,6 +22,7 @@ Resolver, _check_dist_requires_python, ) + from tests.lib import TestData, make_test_finder from tests.lib.index import make_mock_candidate diff --git a/tests/unit/test_self_check_outdated.py b/tests/unit/test_self_check_outdated.py index 605d9182a09..38ce648a09d 100644 --- a/tests/unit/test_self_check_outdated.py +++ b/tests/unit/test_self_check_outdated.py @@ -10,6 +10,7 @@ import pytest from freezegun import freeze_time + from pip._vendor.packaging.version import Version from pip._internal import self_outdated_check diff --git a/tests/unit/test_target_python.py b/tests/unit/test_target_python.py index 31df5935ee3..63e77a3d8a9 100644 --- a/tests/unit/test_target_python.py +++ b/tests/unit/test_target_python.py @@ -2,9 +2,11 @@ from unittest import mock import pytest + from pip._vendor.packaging.tags import Tag from pip._internal.models.target_python import TargetPython + from tests.lib import CURRENT_PY_VERSION_INFO, pyversion diff --git a/tests/unit/test_urls.py b/tests/unit/test_urls.py index c4b8db681ff..539bf091fb2 100644 --- a/tests/unit/test_urls.py +++ b/tests/unit/test_urls.py @@ -5,6 +5,7 @@ import pytest from pip._internal.utils.urls import path_to_url, url_to_path + from tests.lib import ( skip_needs_new_urlun_behavior_win, skip_needs_old_urlun_behavior_win, diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index d1e64262de2..6627a89496d 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -15,6 +15,7 @@ from unittest.mock import Mock, patch import pytest + from pip._vendor.packaging.requirements import Requirement from pip._internal.exceptions import HashMismatch, HashMissing, InstallationError diff --git a/tests/unit/test_utils_unpacking.py b/tests/unit/test_utils_unpacking.py index e0db5c4ba4a..5f89751311a 100644 --- a/tests/unit/test_utils_unpacking.py +++ b/tests/unit/test_utils_unpacking.py @@ -14,6 +14,7 @@ from pip._internal.exceptions import InstallationError from pip._internal.utils.unpacking import is_within_directory, untar_file, unzip_file + from tests.lib import TestData diff --git a/tests/unit/test_utils_wheel.py b/tests/unit/test_utils_wheel.py index 4e8e72be64a..b31b51ccae0 100644 --- a/tests/unit/test_utils_wheel.py +++ b/tests/unit/test_utils_wheel.py @@ -10,6 +10,7 @@ from pip._internal.exceptions import UnsupportedWheel from pip._internal.utils import wheel + from tests.lib import TestData _ZipDir = Callable[[Path], ZipFile] diff --git a/tests/unit/test_vcs.py b/tests/unit/test_vcs.py index 13ef42fc43f..c9a026968f4 100644 --- a/tests/unit/test_vcs.py +++ b/tests/unit/test_vcs.py @@ -14,6 +14,7 @@ from pip._internal.vcs.mercurial import Mercurial from pip._internal.vcs.subversion import Subversion from pip._internal.vcs.versioncontrol import RevOptions, VersionControl + from tests.lib import is_svn_installed, need_svn diff --git a/tests/unit/test_vcs_mercurial.py b/tests/unit/test_vcs_mercurial.py index d8e8f6cad27..ef52795a513 100644 --- a/tests/unit/test_vcs_mercurial.py +++ b/tests/unit/test_vcs_mercurial.py @@ -8,6 +8,7 @@ from pip._internal.utils.misc import hide_url from pip._internal.vcs.mercurial import Mercurial + from tests.lib import need_mercurial diff --git a/tests/unit/test_wheel.py b/tests/unit/test_wheel.py index ed6f5821133..7b44a59e4a4 100644 --- a/tests/unit/test_wheel.py +++ b/tests/unit/test_wheel.py @@ -12,6 +12,7 @@ from unittest.mock import patch import pytest + from pip._vendor.packaging.requirements import Requirement from pip._internal.exceptions import InstallationError @@ -32,6 +33,7 @@ from pip._internal.utils.compat import WINDOWS from pip._internal.utils.misc import hash_file from pip._internal.utils.unpacking import unpack_file + from tests.lib import DATA_DIR, TestData, assert_paths_equal from tests.lib.wheel import make_wheel diff --git a/tests/unit/test_wheel_builder.py b/tests/unit/test_wheel_builder.py index d5f372dd5cd..a657e900b42 100644 --- a/tests/unit/test_wheel_builder.py +++ b/tests/unit/test_wheel_builder.py @@ -11,6 +11,7 @@ from pip._internal.operations.build.wheel_legacy import format_command_result from pip._internal.req.req_install import InstallRequirement from pip._internal.vcs.git import Git + from tests.lib import _create_test_package