diff --git a/tests/conftest.py b/tests/conftest.py index 86e5dfd2b36..5f751cb990a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -29,7 +29,6 @@ from poetry.utils.env import EnvManager from poetry.utils.env import SystemEnv from poetry.utils.env import VirtualEnv -from poetry.utils.helpers import remove_directory from tests.helpers import MOCK_DEFAULT_GIT_REVISION from tests.helpers import TestLocker from tests.helpers import TestRepository @@ -166,8 +165,8 @@ def with_chained_null_keyring(mocker: MockerFixture) -> None: @pytest.fixture -def config_cache_dir(tmp_dir: str) -> Path: - path = Path(tmp_dir) / ".cache" / "pypoetry" +def config_cache_dir(tmp_path: Path) -> Path: + path = tmp_path / ".cache" / "pypoetry" path.mkdir(parents=True) return path @@ -216,8 +215,8 @@ def config( @pytest.fixture() -def config_dir(tmp_dir: str) -> Path: - return Path(tempfile.mkdtemp(prefix="poetry_config_", dir=tmp_dir)) +def config_dir(tmp_path: Path) -> Path: + return Path(tempfile.mkdtemp(prefix="poetry_config_", dir=str(tmp_path))) @pytest.fixture(autouse=True) @@ -292,15 +291,6 @@ def _fixture_dir(name: str) -> Path: return _fixture_dir -@pytest.fixture -def tmp_dir() -> Iterator[str]: - dir_ = tempfile.mkdtemp(prefix="poetry_") - - yield Path(dir_).resolve().as_posix() - - remove_directory(dir_, force=True) - - @pytest.fixture def mocked_open_files(mocker: MockerFixture) -> list: files = [] @@ -317,8 +307,8 @@ def mocked_open(self: Path, *args: Any, **kwargs: Any) -> TextIO: @pytest.fixture -def tmp_venv(tmp_dir: str) -> Iterator[VirtualEnv]: - venv_path = Path(tmp_dir) / "venv" +def tmp_venv(tmp_path: Path) -> Iterator[VirtualEnv]: + venv_path = tmp_path / "venv" EnvManager.build_venv(str(venv_path)) @@ -359,14 +349,14 @@ def repo(http: type[httpretty.httpretty]) -> TestRepository: @pytest.fixture def project_factory( - tmp_dir: str, + tmp_path: Path, config: Config, repo: TestRepository, installed: Repository, default_python: str, load_required_fixtures: None, ) -> ProjectFactory: - workspace = Path(tmp_dir) + workspace = tmp_path def _factory( name: str | None = None, @@ -453,10 +443,10 @@ def set_simple_log_formatter() -> None: @pytest.fixture -def fixture_copier(fixture_base: Path, tmp_dir: str) -> FixtureCopier: +def fixture_copier(fixture_base: Path, tmp_path: Path) -> FixtureCopier: def _copy(relative_path: str, target: Path | None = None) -> Path: path = fixture_base.joinpath(relative_path) - target = target or Path(tmp_dir, relative_path) + target = target or Path(tmp_path, relative_path) target.parent.mkdir(parents=True, exist_ok=True) if target.exists(): diff --git a/tests/console/commands/env/conftest.py b/tests/console/commands/env/conftest.py index 832efe5e5cc..1652fc90c3a 100644 --- a/tests/console/commands/env/conftest.py +++ b/tests/console/commands/env/conftest.py @@ -2,7 +2,6 @@ import os -from pathlib import Path from typing import TYPE_CHECKING import pytest @@ -12,6 +11,7 @@ if TYPE_CHECKING: from collections.abc import Iterator + from pathlib import Path from tests.helpers import PoetryTestApplication @@ -25,8 +25,8 @@ def venv_name(app: PoetryTestApplication) -> str: @pytest.fixture -def venv_cache(tmp_dir: str) -> Path: - return Path(tmp_dir) +def venv_cache(tmp_path: Path) -> Path: + return tmp_path @pytest.fixture(scope="module") diff --git a/tests/console/commands/self/test_show_plugins.py b/tests/console/commands/self/test_show_plugins.py index 3ce27786760..6b6fba955f2 100644 --- a/tests/console/commands/self/test_show_plugins.py +++ b/tests/console/commands/self/test_show_plugins.py @@ -64,7 +64,7 @@ def plugin_package(plugin_package_requires_dist: list[str]) -> Package: @pytest.fixture() -def plugin_distro(plugin_package: Package, tmp_dir: str) -> metadata.Distribution: +def plugin_distro(plugin_package: Package, tmp_path: Path) -> metadata.Distribution: class MockDistribution(metadata.Distribution): def read_text(self, filename: str) -> str | None: if filename == "METADATA": @@ -81,7 +81,7 @@ def read_text(self, filename: str) -> str | None: return None def locate_file(self, path: PathLike[str]) -> PathLike[str]: - return Path(tmp_dir, path) + return Path(tmp_path, path) return MockDistribution() diff --git a/tests/console/commands/test_new.py b/tests/console/commands/test_new.py index 79f09e20f27..6f0415a85ce 100644 --- a/tests/console/commands/test_new.py +++ b/tests/console/commands/test_new.py @@ -149,18 +149,20 @@ def test_command_new( package_path: str, include_from: str | None, tester: CommandTester, - tmp_dir: str, + tmp_path: Path, ): - path = Path(tmp_dir) / directory + path = tmp_path / directory options.append(path.as_posix()) tester.execute(" ".join(options)) verify_project_directory(path, package_name, package_path, include_from) @pytest.mark.parametrize(("fmt",), [(None,), ("md",), ("rst",), ("adoc",), ("creole",)]) -def test_command_new_with_readme(fmt: str | None, tester: CommandTester, tmp_dir: str): +def test_command_new_with_readme( + fmt: str | None, tester: CommandTester, tmp_path: Path +): package = "package" - path = Path(tmp_dir) / package + path = tmp_path / package options = [path.as_posix()] if fmt: diff --git a/tests/console/conftest.py b/tests/console/conftest.py index a78ceaa89f9..4b9d8d534d5 100644 --- a/tests/console/conftest.py +++ b/tests/console/conftest.py @@ -40,8 +40,8 @@ def installer() -> NoopInstaller: @pytest.fixture -def env(tmp_dir: str) -> MockEnv: - path = Path(tmp_dir) / ".venv" +def env(tmp_path: Path) -> MockEnv: + path = tmp_path / ".venv" path.mkdir(parents=True) return MockEnv(path=path, is_venv=True) diff --git a/tests/installation/test_executor.py b/tests/installation/test_executor.py index 6b8de09546b..f923712d2f8 100644 --- a/tests/installation/test_executor.py +++ b/tests/installation/test_executor.py @@ -38,8 +38,8 @@ @pytest.fixture -def env(tmp_dir: str) -> MockEnv: - path = Path(tmp_dir) / ".venv" +def env(tmp_path: Path) -> MockEnv: + path = tmp_path / ".venv" path.mkdir(parents=True) return MockEnv(path=path, is_venv=True) @@ -104,13 +104,13 @@ def test_execute_executes_a_batch_of_operations( config: Config, pool: RepositoryPool, io: BufferedIO, - tmp_dir: str, + tmp_path: Path, mock_file_downloads: None, env: MockEnv, ): pip_install = mocker.patch("poetry.installation.executor.pip_install") - config.merge({"cache-dir": tmp_dir}) + config.merge({"cache-dir": str(tmp_path)}) executor = Executor(env, pool, config, io) @@ -205,13 +205,13 @@ def test_execute_prints_warning_for_yanked_package( config: Config, pool: RepositoryPool, io: BufferedIO, - tmp_dir: str, + tmp_path: Path, mock_file_downloads: None, env: MockEnv, operations: list[Operation], has_warning: bool, ): - config.merge({"cache-dir": tmp_dir}) + config.merge({"cache-dir": str(tmp_path)}) executor = Executor(env, pool, config, io) @@ -293,11 +293,11 @@ def test_execute_works_with_ansi_output( config: Config, pool: RepositoryPool, io_decorated: BufferedIO, - tmp_dir: str, + tmp_path: Path, mock_file_downloads: None, env: MockEnv, ): - config.merge({"cache-dir": tmp_dir}) + config.merge({"cache-dir": str(tmp_path)}) executor = Executor(env, pool, config, io_decorated) @@ -335,11 +335,11 @@ def test_execute_works_with_no_ansi_output( config: Config, pool: RepositoryPool, io_not_decorated: BufferedIO, - tmp_dir: str, + tmp_path: Path, mock_file_downloads: None, env: MockEnv, ): - config.merge({"cache-dir": tmp_dir}) + config.merge({"cache-dir": str(tmp_path)}) executor = Executor(env, pool, config, io_not_decorated) @@ -424,7 +424,7 @@ def write_line(string: str, **kwargs: Any) -> None: def test_executor_should_delete_incomplete_downloads( config: Config, io: BufferedIO, - tmp_dir: str, + tmp_path: Path, mocker: MockerFixture, pool: RepositoryPool, mock_file_downloads: None, @@ -433,7 +433,7 @@ def test_executor_should_delete_incomplete_downloads( fixture = Path(__file__).parent.parent.joinpath( "fixtures/distributions/demo-0.1.0-py2.py3-none-any.whl" ) - destination_fixture = Path(tmp_dir) / "tomlkit-0.5.3-py2.py3-none-any.whl" + destination_fixture = tmp_path / "tomlkit-0.5.3-py2.py3-none-any.whl" shutil.copyfile(str(fixture), str(destination_fixture)) mocker.patch( "poetry.installation.executor.Executor._download_archive", @@ -445,10 +445,10 @@ def test_executor_should_delete_incomplete_downloads( ) mocker.patch( "poetry.installation.chef.Chef.get_cache_directory_for_link", - return_value=Path(tmp_dir), + return_value=tmp_path, ) - config.merge({"cache-dir": tmp_dir}) + config.merge({"cache-dir": str(tmp_path)}) executor = Executor(env, pool, config, io) @@ -727,7 +727,7 @@ def test_executer_fallback_on_poetry_create_error( config: Config, pool: RepositoryPool, io: BufferedIO, - tmp_dir: str, + tmp_path: Path, mock_file_downloads: None, env: MockEnv, ): @@ -740,7 +740,7 @@ def test_executer_fallback_on_poetry_create_error( "poetry.factory.Factory.create_poetry", side_effect=RuntimeError ) - config.merge({"cache-dir": tmp_dir}) + config.merge({"cache-dir": str(tmp_path)}) executor = Executor(env, pool, config, io) diff --git a/tests/masonry/builders/test_editable_builder.py b/tests/masonry/builders/test_editable_builder.py index 020c9cc13ae..05a69ad90eb 100644 --- a/tests/masonry/builders/test_editable_builder.py +++ b/tests/masonry/builders/test_editable_builder.py @@ -74,8 +74,8 @@ def env_manager(simple_poetry: Poetry) -> EnvManager: @pytest.fixture -def tmp_venv(tmp_dir: str, env_manager: EnvManager) -> VirtualEnv: - venv_path = Path(tmp_dir) / "venv" +def tmp_venv(tmp_path: Path, env_manager: EnvManager) -> VirtualEnv: + venv_path = tmp_path / "venv" env_manager.build_venv(str(venv_path)) @@ -213,10 +213,10 @@ def test_builder_installs_proper_files_for_standard_packages( def test_builder_falls_back_on_setup_and_pip_for_packages_with_build_scripts( - mocker: MockerFixture, extended_poetry: Poetry, tmp_dir: str + mocker: MockerFixture, extended_poetry: Poetry, tmp_path: Path ): pip_install = mocker.patch("poetry.masonry.builders.editable.pip_install") - env = MockEnv(path=Path(tmp_dir) / "foo") + env = MockEnv(path=tmp_path / "foo") builder = EditableBuilder(extended_poetry, env, NullIO()) builder.build() @@ -226,10 +226,10 @@ def test_builder_falls_back_on_setup_and_pip_for_packages_with_build_scripts( assert [] == env.executed -def test_builder_setup_generation_runs_with_pip_editable(tmp_dir: str) -> None: +def test_builder_setup_generation_runs_with_pip_editable(tmp_path: Path) -> None: # create an isolated copy of the project fixture = Path(__file__).parent.parent.parent / "fixtures" / "extended_project" - extended_project = Path(tmp_dir) / "extended_project" + extended_project = tmp_path / "extended_project" shutil.copytree(fixture, extended_project) assert extended_project.exists() diff --git a/tests/plugins/test_plugin_manager.py b/tests/plugins/test_plugin_manager.py index 868d61f26f0..c265bfda686 100644 --- a/tests/plugins/test_plugin_manager.py +++ b/tests/plugins/test_plugin_manager.py @@ -47,7 +47,7 @@ def activate(self, poetry: Poetry, io: BufferedIO) -> None: @pytest.fixture() -def poetry(tmp_dir: str, config: Config) -> Poetry: +def poetry(config: Config) -> Poetry: poetry = Poetry( CWD / "pyproject.toml", {}, diff --git a/tests/repositories/test_installed_repository.py b/tests/repositories/test_installed_repository.py index 87dfe183c8a..ac796e6b5d1 100644 --- a/tests/repositories/test_installed_repository.py +++ b/tests/repositories/test_installed_repository.py @@ -108,9 +108,9 @@ def test_load_successful(repository: InstalledRepository): def test_load_successful_with_invalid_distribution( - caplog: LogCaptureFixture, mocker: MockerFixture, env: MockEnv, tmp_dir: str + caplog: LogCaptureFixture, mocker: MockerFixture, env: MockEnv, tmp_path: Path ) -> None: - invalid_dist_info = Path(tmp_dir) / "site-packages" / "invalid-0.1.0.dist-info" + invalid_dist_info = tmp_path / "site-packages" / "invalid-0.1.0.dist-info" invalid_dist_info.mkdir(parents=True) mocker.patch( "poetry.utils._compat.metadata.Distribution.discover", diff --git a/tests/utils/test_env.py b/tests/utils/test_env.py index 8df2abb175f..20a3ccba283 100644 --- a/tests/utils/test_env.py +++ b/tests/utils/test_env.py @@ -85,9 +85,9 @@ def manager(poetry: Poetry) -> EnvManager: def test_virtualenvs_with_spaces_in_their_path_work_as_expected( - tmp_dir: str, manager: EnvManager + tmp_path: Path, manager: EnvManager ): - venv_path = Path(tmp_dir) / "Virtual Env" + venv_path = tmp_path / "Virtual Env" manager.build_venv(str(venv_path)) @@ -97,10 +97,10 @@ def test_virtualenvs_with_spaces_in_their_path_work_as_expected( @pytest.mark.skipif(sys.platform != "darwin", reason="requires darwin") -def test_venv_backup_exclusion(tmp_dir: str, manager: EnvManager): +def test_venv_backup_exclusion(tmp_path: Path, manager: EnvManager): import xattr - venv_path = Path(tmp_dir) / "Virtual Env" + venv_path = tmp_path / "Virtual Env" manager.build_venv(str(venv_path)) @@ -118,9 +118,9 @@ def test_venv_backup_exclusion(tmp_dir: str, manager: EnvManager): def test_env_commands_with_spaces_in_their_arg_work_as_expected( - tmp_dir: str, manager: EnvManager + tmp_path: Path, manager: EnvManager ): - venv_path = Path(tmp_dir) / "Virtual Env" + venv_path = tmp_path / "Virtual Env" manager.build_venv(str(venv_path)) venv = VirtualEnv(venv_path) assert venv.run("python", venv.pip, "--version", shell=True).startswith( @@ -129,9 +129,9 @@ def test_env_commands_with_spaces_in_their_arg_work_as_expected( def test_env_shell_commands_with_stdinput_in_their_arg_work_as_expected( - tmp_dir: str, manager: EnvManager + tmp_path: Path, manager: EnvManager ): - venv_path = Path(tmp_dir) / "Virtual Env" + venv_path = tmp_path / "Virtual Env" manager.build_venv(str(venv_path)) venv = VirtualEnv(venv_path) run_output_path = Path( @@ -142,9 +142,9 @@ def test_env_shell_commands_with_stdinput_in_their_arg_work_as_expected( def test_env_get_supported_tags_matches_inside_virtualenv( - tmp_dir: str, manager: EnvManager + tmp_path: Path, manager: EnvManager ): - venv_path = Path(tmp_dir) / "Virtual Env" + venv_path = tmp_path / "Virtual Env" manager.build_venv(str(venv_path)) venv = VirtualEnv(venv_path) @@ -203,7 +203,7 @@ def check_output(cmd: str, *args: Any, **kwargs: Any) -> str: def test_activate_activates_non_existing_virtualenv_no_envs_file( - tmp_dir: str, + tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, @@ -213,7 +213,7 @@ def test_activate_activates_non_existing_virtualenv_no_envs_file( if "VIRTUAL_ENV" in os.environ: del os.environ["VIRTUAL_ENV"] - config.merge({"virtualenvs": {"path": str(tmp_dir)}}) + config.merge({"virtualenvs": {"path": str(tmp_path)}}) mocker.patch( "subprocess.check_output", @@ -228,7 +228,7 @@ def test_activate_activates_non_existing_virtualenv_no_envs_file( env = manager.activate("python3.7") m.assert_called_with( - Path(tmp_dir) / f"{venv_name}-py3.7", + tmp_path / f"{venv_name}-py3.7", executable="/usr/bin/python3.7", flags={ "always-copy": False, @@ -239,18 +239,18 @@ def test_activate_activates_non_existing_virtualenv_no_envs_file( prompt="simple-project-py3.7", ) - envs_file = TOMLFile(Path(tmp_dir) / "envs.toml") + envs_file = TOMLFile(tmp_path / "envs.toml") assert envs_file.exists() envs = envs_file.read() assert envs[venv_name]["minor"] == "3.7" assert envs[venv_name]["patch"] == "3.7.1" - assert env.path == Path(tmp_dir) / f"{venv_name}-py3.7" + assert env.path == tmp_path / f"{venv_name}-py3.7" assert env.base == Path("/prefix") def test_activate_activates_existing_virtualenv_no_envs_file( - tmp_dir: str, + tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, @@ -260,9 +260,9 @@ def test_activate_activates_existing_virtualenv_no_envs_file( if "VIRTUAL_ENV" in os.environ: del os.environ["VIRTUAL_ENV"] - os.mkdir(os.path.join(tmp_dir, f"{venv_name}-py3.7")) + os.mkdir(tmp_path / f"{venv_name}-py3.7") - config.merge({"virtualenvs": {"path": str(tmp_dir)}}) + config.merge({"virtualenvs": {"path": str(tmp_path)}}) mocker.patch( "subprocess.check_output", @@ -278,18 +278,18 @@ def test_activate_activates_existing_virtualenv_no_envs_file( m.assert_not_called() - envs_file = TOMLFile(Path(tmp_dir) / "envs.toml") + envs_file = TOMLFile(tmp_path / "envs.toml") assert envs_file.exists() envs = envs_file.read() assert envs[venv_name]["minor"] == "3.7" assert envs[venv_name]["patch"] == "3.7.1" - assert env.path == Path(tmp_dir) / f"{venv_name}-py3.7" + assert env.path == tmp_path / f"{venv_name}-py3.7" assert env.base == Path("/prefix") def test_activate_activates_same_virtualenv_with_envs_file( - tmp_dir: str, + tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, @@ -299,14 +299,14 @@ def test_activate_activates_same_virtualenv_with_envs_file( if "VIRTUAL_ENV" in os.environ: del os.environ["VIRTUAL_ENV"] - envs_file = TOMLFile(Path(tmp_dir) / "envs.toml") + envs_file = TOMLFile(tmp_path / "envs.toml") doc = tomlkit.document() doc[venv_name] = {"minor": "3.7", "patch": "3.7.1"} envs_file.write(doc) - os.mkdir(os.path.join(tmp_dir, f"{venv_name}-py3.7")) + os.mkdir(tmp_path / f"{venv_name}-py3.7") - config.merge({"virtualenvs": {"path": str(tmp_dir)}}) + config.merge({"virtualenvs": {"path": str(tmp_path)}}) mocker.patch( "subprocess.check_output", @@ -327,12 +327,12 @@ def test_activate_activates_same_virtualenv_with_envs_file( assert envs[venv_name]["minor"] == "3.7" assert envs[venv_name]["patch"] == "3.7.1" - assert env.path == Path(tmp_dir) / f"{venv_name}-py3.7" + assert env.path == tmp_path / f"{venv_name}-py3.7" assert env.base == Path("/prefix") def test_activate_activates_different_virtualenv_with_envs_file( - tmp_dir: str, + tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, @@ -342,14 +342,14 @@ def test_activate_activates_different_virtualenv_with_envs_file( if "VIRTUAL_ENV" in os.environ: del os.environ["VIRTUAL_ENV"] - envs_file = TOMLFile(Path(tmp_dir) / "envs.toml") + envs_file = TOMLFile(tmp_path / "envs.toml") doc = tomlkit.document() doc[venv_name] = {"minor": "3.7", "patch": "3.7.1"} envs_file.write(doc) - os.mkdir(os.path.join(tmp_dir, f"{venv_name}-py3.7")) + os.mkdir(tmp_path / f"{venv_name}-py3.7") - config.merge({"virtualenvs": {"path": str(tmp_dir)}}) + config.merge({"virtualenvs": {"path": str(tmp_path)}}) mocker.patch( "subprocess.check_output", @@ -364,7 +364,7 @@ def test_activate_activates_different_virtualenv_with_envs_file( env = manager.activate("python3.6") m.assert_called_with( - Path(tmp_dir) / f"{venv_name}-py3.6", + tmp_path / f"{venv_name}-py3.6", executable="/usr/bin/python3.6", flags={ "always-copy": False, @@ -380,12 +380,12 @@ def test_activate_activates_different_virtualenv_with_envs_file( assert envs[venv_name]["minor"] == "3.6" assert envs[venv_name]["patch"] == "3.6.6" - assert env.path == Path(tmp_dir) / f"{venv_name}-py3.6" + assert env.path == tmp_path / f"{venv_name}-py3.6" assert env.base == Path("/prefix") def test_activate_activates_recreates_for_different_patch( - tmp_dir: str, + tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, @@ -395,14 +395,14 @@ def test_activate_activates_recreates_for_different_patch( if "VIRTUAL_ENV" in os.environ: del os.environ["VIRTUAL_ENV"] - envs_file = TOMLFile(Path(tmp_dir) / "envs.toml") + envs_file = TOMLFile(tmp_path / "envs.toml") doc = tomlkit.document() doc[venv_name] = {"minor": "3.7", "patch": "3.7.0"} envs_file.write(doc) - os.mkdir(os.path.join(tmp_dir, f"{venv_name}-py3.7")) + os.mkdir(tmp_path / f"{venv_name}-py3.7") - config.merge({"virtualenvs": {"path": str(tmp_dir)}}) + config.merge({"virtualenvs": {"path": str(tmp_path)}}) mocker.patch( "subprocess.check_output", @@ -428,7 +428,7 @@ def test_activate_activates_recreates_for_different_patch( env = manager.activate("python3.7") build_venv_m.assert_called_with( - Path(tmp_dir) / f"{venv_name}-py3.7", + tmp_path / f"{venv_name}-py3.7", executable="/usr/bin/python3.7", flags={ "always-copy": False, @@ -438,20 +438,20 @@ def test_activate_activates_recreates_for_different_patch( }, prompt="simple-project-py3.7", ) - remove_venv_m.assert_called_with(Path(tmp_dir) / f"{venv_name}-py3.7") + remove_venv_m.assert_called_with(tmp_path / f"{venv_name}-py3.7") assert envs_file.exists() envs = envs_file.read() assert envs[venv_name]["minor"] == "3.7" assert envs[venv_name]["patch"] == "3.7.1" - assert env.path == Path(tmp_dir) / f"{venv_name}-py3.7" + assert env.path == tmp_path / f"{venv_name}-py3.7" assert env.base == Path("/prefix") - assert (Path(tmp_dir) / f"{venv_name}-py3.7").exists() + assert (tmp_path / f"{venv_name}-py3.7").exists() def test_activate_does_not_recreate_when_switching_minor( - tmp_dir: str, + tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, @@ -461,15 +461,15 @@ def test_activate_does_not_recreate_when_switching_minor( if "VIRTUAL_ENV" in os.environ: del os.environ["VIRTUAL_ENV"] - envs_file = TOMLFile(Path(tmp_dir) / "envs.toml") + envs_file = TOMLFile(tmp_path / "envs.toml") doc = tomlkit.document() doc[venv_name] = {"minor": "3.7", "patch": "3.7.0"} envs_file.write(doc) - os.mkdir(os.path.join(tmp_dir, f"{venv_name}-py3.7")) - os.mkdir(os.path.join(tmp_dir, f"{venv_name}-py3.6")) + os.mkdir(tmp_path / f"{venv_name}-py3.7") + os.mkdir(tmp_path / f"{venv_name}-py3.6") - config.merge({"virtualenvs": {"path": str(tmp_dir)}}) + config.merge({"virtualenvs": {"path": str(tmp_path)}}) mocker.patch( "subprocess.check_output", @@ -496,13 +496,13 @@ def test_activate_does_not_recreate_when_switching_minor( assert envs[venv_name]["minor"] == "3.6" assert envs[venv_name]["patch"] == "3.6.6" - assert env.path == Path(tmp_dir) / f"{venv_name}-py3.6" + assert env.path == tmp_path / f"{venv_name}-py3.6" assert env.base == Path("/prefix") - assert (Path(tmp_dir) / f"{venv_name}-py3.6").exists() + assert (tmp_path / f"{venv_name}-py3.6").exists() def test_deactivate_non_activated_but_existing( - tmp_dir: str, + tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, @@ -513,9 +513,9 @@ def test_deactivate_non_activated_but_existing( del os.environ["VIRTUAL_ENV"] python = ".".join(str(c) for c in sys.version_info[:2]) - (Path(tmp_dir) / f"{venv_name}-py{python}").mkdir() + (tmp_path / f"{venv_name}-py{python}").mkdir() - config.merge({"virtualenvs": {"path": str(tmp_dir)}}) + config.merge({"virtualenvs": {"path": str(tmp_path)}}) mocker.patch( "subprocess.check_output", @@ -525,12 +525,12 @@ def test_deactivate_non_activated_but_existing( manager.deactivate() env = manager.get() - assert env.path == Path(tmp_dir) / f"{venv_name}-py{python}" + assert env.path == tmp_path / f"{venv_name}-py{python}" assert Path("/prefix") def test_deactivate_activated( - tmp_dir: str, + tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, @@ -542,12 +542,10 @@ def test_deactivate_activated( version = Version.from_parts(*sys.version_info[:3]) other_version = Version.parse("3.4") if version.major == 2 else version.next_minor() - (Path(tmp_dir) / f"{venv_name}-py{version.major}.{version.minor}").mkdir() - ( - Path(tmp_dir) / f"{venv_name}-py{other_version.major}.{other_version.minor}" - ).mkdir() + (tmp_path / f"{venv_name}-py{version.major}.{version.minor}").mkdir() + (tmp_path / f"{venv_name}-py{other_version.major}.{other_version.minor}").mkdir() - envs_file = TOMLFile(Path(tmp_dir) / "envs.toml") + envs_file = TOMLFile(tmp_path / "envs.toml") doc = tomlkit.document() doc[venv_name] = { "minor": f"{other_version.major}.{other_version.minor}", @@ -555,7 +553,7 @@ def test_deactivate_activated( } envs_file.write(doc) - config.merge({"virtualenvs": {"path": str(tmp_dir)}}) + config.merge({"virtualenvs": {"path": str(tmp_path)}}) mocker.patch( "subprocess.check_output", @@ -565,7 +563,7 @@ def test_deactivate_activated( manager.deactivate() env = manager.get() - assert env.path == Path(tmp_dir) / f"{venv_name}-py{version.major}.{version.minor}" + assert env.path == tmp_path / f"{venv_name}-py{version.major}.{version.minor}" assert Path("/prefix") envs = envs_file.read() @@ -573,7 +571,7 @@ def test_deactivate_activated( def test_get_prefers_explicitly_activated_virtualenvs_over_env_var( - tmp_dir: str, + tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, @@ -582,10 +580,10 @@ def test_get_prefers_explicitly_activated_virtualenvs_over_env_var( ): os.environ["VIRTUAL_ENV"] = "/environment/prefix" - config.merge({"virtualenvs": {"path": str(tmp_dir)}}) - (Path(tmp_dir) / f"{venv_name}-py3.7").mkdir() + config.merge({"virtualenvs": {"path": str(tmp_path)}}) + (tmp_path / f"{venv_name}-py3.7").mkdir() - envs_file = TOMLFile(Path(tmp_dir) / "envs.toml") + envs_file = TOMLFile(tmp_path / "envs.toml") doc = tomlkit.document() doc[venv_name] = {"minor": "3.7", "patch": "3.7.0"} envs_file.write(doc) @@ -601,41 +599,41 @@ def test_get_prefers_explicitly_activated_virtualenvs_over_env_var( env = manager.get() - assert env.path == Path(tmp_dir) / f"{venv_name}-py3.7" + assert env.path == tmp_path / f"{venv_name}-py3.7" assert env.base == Path("/prefix") def test_list( - tmp_dir: str, + tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, venv_name: str, ): - config.merge({"virtualenvs": {"path": str(tmp_dir)}}) + config.merge({"virtualenvs": {"path": str(tmp_path)}}) - (Path(tmp_dir) / f"{venv_name}-py3.7").mkdir() - (Path(tmp_dir) / f"{venv_name}-py3.6").mkdir() + (tmp_path / f"{venv_name}-py3.7").mkdir() + (tmp_path / f"{venv_name}-py3.6").mkdir() venvs = manager.list() assert len(venvs) == 2 - assert venvs[0].path == (Path(tmp_dir) / f"{venv_name}-py3.6") - assert venvs[1].path == (Path(tmp_dir) / f"{venv_name}-py3.7") + assert venvs[0].path == (tmp_path / f"{venv_name}-py3.6") + assert venvs[1].path == (tmp_path / f"{venv_name}-py3.7") def test_remove_by_python_version( - tmp_dir: str, + tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, mocker: MockerFixture, venv_name: str, ): - config.merge({"virtualenvs": {"path": str(tmp_dir)}}) + config.merge({"virtualenvs": {"path": str(tmp_path)}}) - (Path(tmp_dir) / f"{venv_name}-py3.7").mkdir() - (Path(tmp_dir) / f"{venv_name}-py3.6").mkdir() + (tmp_path / f"{venv_name}-py3.7").mkdir() + (tmp_path / f"{venv_name}-py3.6").mkdir() mocker.patch( "subprocess.check_output", @@ -644,23 +642,23 @@ def test_remove_by_python_version( venv = manager.remove("3.6") - expected_venv_path = Path(tmp_dir) / f"{venv_name}-py3.6" + expected_venv_path = tmp_path / f"{venv_name}-py3.6" assert venv.path == expected_venv_path assert not expected_venv_path.exists() def test_remove_by_name( - tmp_dir: str, + tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, mocker: MockerFixture, venv_name: str, ): - config.merge({"virtualenvs": {"path": str(tmp_dir)}}) + config.merge({"virtualenvs": {"path": str(tmp_path)}}) - (Path(tmp_dir) / f"{venv_name}-py3.7").mkdir() - (Path(tmp_dir) / f"{venv_name}-py3.6").mkdir() + (tmp_path / f"{venv_name}-py3.7").mkdir() + (tmp_path / f"{venv_name}-py3.6").mkdir() mocker.patch( "subprocess.check_output", @@ -669,23 +667,23 @@ def test_remove_by_name( venv = manager.remove(f"{venv_name}-py3.6") - expected_venv_path = Path(tmp_dir) / f"{venv_name}-py3.6" + expected_venv_path = tmp_path / f"{venv_name}-py3.6" assert venv.path == expected_venv_path assert not expected_venv_path.exists() def test_remove_by_string_with_python_and_version( - tmp_dir: str, + tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, mocker: MockerFixture, venv_name: str, ): - config.merge({"virtualenvs": {"path": str(tmp_dir)}}) + config.merge({"virtualenvs": {"path": str(tmp_path)}}) - (Path(tmp_dir) / f"{venv_name}-py3.7").mkdir() - (Path(tmp_dir) / f"{venv_name}-py3.6").mkdir() + (tmp_path / f"{venv_name}-py3.7").mkdir() + (tmp_path / f"{venv_name}-py3.6").mkdir() mocker.patch( "subprocess.check_output", @@ -694,30 +692,30 @@ def test_remove_by_string_with_python_and_version( venv = manager.remove("python3.6") - expected_venv_path = Path(tmp_dir) / f"{venv_name}-py3.6" + expected_venv_path = tmp_path / f"{venv_name}-py3.6" assert venv.path == expected_venv_path assert not expected_venv_path.exists() def test_remove_by_full_path_to_python( - tmp_dir: str, + tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, mocker: MockerFixture, venv_name: str, ): - config.merge({"virtualenvs": {"path": str(tmp_dir)}}) + config.merge({"virtualenvs": {"path": str(tmp_path)}}) - (Path(tmp_dir) / f"{venv_name}-py3.7").mkdir() - (Path(tmp_dir) / f"{venv_name}-py3.6").mkdir() + (tmp_path / f"{venv_name}-py3.7").mkdir() + (tmp_path / f"{venv_name}-py3.6").mkdir() mocker.patch( "subprocess.check_output", side_effect=check_output_wrapper(Version.parse("3.6.6")), ) - expected_venv_path = Path(tmp_dir) / f"{venv_name}-py3.6" + expected_venv_path = tmp_path / f"{venv_name}-py3.6" python_path = expected_venv_path / "bin" / "python" venv = manager.remove(str(python_path)) @@ -727,16 +725,16 @@ def test_remove_by_full_path_to_python( def test_raises_if_acting_on_different_project_by_full_path( - tmp_dir: str, + tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, mocker: MockerFixture, ): - config.merge({"virtualenvs": {"path": str(tmp_dir)}}) + config.merge({"virtualenvs": {"path": str(tmp_path)}}) different_venv_name = "different-project" - different_venv_path = Path(tmp_dir) / f"{different_venv_name}-py3.6" + different_venv_path = tmp_path / f"{different_venv_name}-py3.6" different_venv_bin_path = different_venv_path / "bin" different_venv_bin_path.mkdir(parents=True) @@ -754,12 +752,12 @@ def test_raises_if_acting_on_different_project_by_full_path( def test_raises_if_acting_on_different_project_by_name( - tmp_dir: str, + tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, ): - config.merge({"virtualenvs": {"path": str(tmp_dir)}}) + config.merge({"virtualenvs": {"path": str(tmp_path)}}) different_venv_name = ( EnvManager.generate_env_name( @@ -768,7 +766,7 @@ def test_raises_if_acting_on_different_project_by_name( ) + "-py3.6" ) - different_venv_path = Path(tmp_dir) / different_venv_name + different_venv_path = tmp_path / different_venv_name different_venv_bin_path = different_venv_path / "bin" different_venv_bin_path.mkdir(parents=True) @@ -780,7 +778,7 @@ def test_raises_if_acting_on_different_project_by_name( def test_raises_when_passing_old_env_after_dir_rename( - tmp_dir: str, + tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, @@ -790,17 +788,17 @@ def test_raises_when_passing_old_env_after_dir_rename( # root directory of the project, which will create another venv with new name. # This is not ideal as you still "can't" remove it by name, but it at least doesn't # cause any unwanted side effects - config.merge({"virtualenvs": {"path": str(tmp_dir)}}) + config.merge({"virtualenvs": {"path": str(tmp_path)}}) previous_venv_name = EnvManager.generate_env_name( poetry.package.name, "previous_dir_name", ) - venv_path = Path(tmp_dir) / f"{venv_name}-py3.6" + venv_path = tmp_path / f"{venv_name}-py3.6" venv_path.mkdir() previous_venv_name = f"{previous_venv_name}-py3.6" - previous_venv_path = Path(tmp_dir) / previous_venv_name + previous_venv_path = tmp_path / previous_venv_name previous_venv_path.mkdir() with pytest.raises(IncorrectEnvError): @@ -808,31 +806,31 @@ def test_raises_when_passing_old_env_after_dir_rename( def test_remove_also_deactivates( - tmp_dir: str, + tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, mocker: MockerFixture, venv_name: str, ): - config.merge({"virtualenvs": {"path": str(tmp_dir)}}) + config.merge({"virtualenvs": {"path": str(tmp_path)}}) - (Path(tmp_dir) / f"{venv_name}-py3.7").mkdir() - (Path(tmp_dir) / f"{venv_name}-py3.6").mkdir() + (tmp_path / f"{venv_name}-py3.7").mkdir() + (tmp_path / f"{venv_name}-py3.6").mkdir() mocker.patch( "subprocess.check_output", side_effect=check_output_wrapper(Version.parse("3.6.6")), ) - envs_file = TOMLFile(Path(tmp_dir) / "envs.toml") + envs_file = TOMLFile(tmp_path / "envs.toml") doc = tomlkit.document() doc[venv_name] = {"minor": "3.6", "patch": "3.6.6"} envs_file.write(doc) venv = manager.remove("python3.6") - expected_venv_path = Path(tmp_dir) / f"{venv_name}-py3.6" + expected_venv_path = tmp_path / f"{venv_name}-py3.6" assert venv.path == expected_venv_path assert not expected_venv_path.exists() @@ -841,7 +839,7 @@ def test_remove_also_deactivates( def test_remove_keeps_dir_if_not_deleteable( - tmp_dir: str, + tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, @@ -850,9 +848,9 @@ def test_remove_keeps_dir_if_not_deleteable( ): # Ensure we empty rather than delete folder if its is an active mount point. # See https://github.com/python-poetry/poetry/pull/2064 - config.merge({"virtualenvs": {"path": str(tmp_dir)}}) + config.merge({"virtualenvs": {"path": str(tmp_path)}}) - venv_path = Path(tmp_dir) / f"{venv_name}-py3.6" + venv_path = tmp_path / f"{venv_name}-py3.6" venv_path.mkdir() folder1_path = venv_path / "folder1" @@ -894,17 +892,17 @@ def err_on_rm_venv_only(path: Path | str, *args: Any, **kwargs: Any) -> None: @pytest.mark.skipif(os.name == "nt", reason="Symlinks are not support for Windows") -def test_env_has_symlinks_on_nix(tmp_dir: str, tmp_venv: VirtualEnv): +def test_env_has_symlinks_on_nix(tmp_path: Path, tmp_venv: VirtualEnv): assert os.path.islink(tmp_venv.python) -def test_run_with_input(tmp_dir: str, tmp_venv: VirtualEnv): +def test_run_with_input(tmp_path: Path, tmp_venv: VirtualEnv): result = tmp_venv.run("python", "-", input_=MINIMAL_SCRIPT) assert result == "Minimal Output" + os.linesep -def test_run_with_input_non_zero_return(tmp_dir: str, tmp_venv: VirtualEnv): +def test_run_with_input_non_zero_return(tmp_path: Path, tmp_venv: VirtualEnv): with pytest.raises(EnvCommandError) as process_error: # Test command that will return non-zero returncode. tmp_venv.run("python", "-", input_=ERRORING_SCRIPT) @@ -913,7 +911,7 @@ def test_run_with_input_non_zero_return(tmp_dir: str, tmp_venv: VirtualEnv): def test_run_with_keyboard_interrupt( - tmp_dir: str, tmp_venv: VirtualEnv, mocker: MockerFixture + tmp_path: Path, tmp_venv: VirtualEnv, mocker: MockerFixture ): mocker.patch("subprocess.run", side_effect=KeyboardInterrupt()) with pytest.raises(KeyboardInterrupt): @@ -922,7 +920,7 @@ def test_run_with_keyboard_interrupt( def test_call_with_input_and_keyboard_interrupt( - tmp_dir: str, tmp_venv: VirtualEnv, mocker: MockerFixture + tmp_path: Path, tmp_venv: VirtualEnv, mocker: MockerFixture ): mocker.patch("subprocess.run", side_effect=KeyboardInterrupt()) kwargs = {"call": True} @@ -932,7 +930,7 @@ def test_call_with_input_and_keyboard_interrupt( def test_call_no_input_with_keyboard_interrupt( - tmp_dir: str, tmp_venv: VirtualEnv, mocker: MockerFixture + tmp_path: Path, tmp_venv: VirtualEnv, mocker: MockerFixture ): mocker.patch("subprocess.call", side_effect=KeyboardInterrupt()) kwargs = {"call": True} @@ -942,7 +940,7 @@ def test_call_no_input_with_keyboard_interrupt( def test_run_with_called_process_error( - tmp_dir: str, tmp_venv: VirtualEnv, mocker: MockerFixture + tmp_path: Path, tmp_venv: VirtualEnv, mocker: MockerFixture ): mocker.patch( "subprocess.run", side_effect=subprocess.CalledProcessError(42, "some_command") @@ -953,7 +951,7 @@ def test_run_with_called_process_error( def test_call_with_input_and_called_process_error( - tmp_dir: str, tmp_venv: VirtualEnv, mocker: MockerFixture + tmp_path: Path, tmp_venv: VirtualEnv, mocker: MockerFixture ): mocker.patch( "subprocess.run", side_effect=subprocess.CalledProcessError(42, "some_command") @@ -965,7 +963,7 @@ def test_call_with_input_and_called_process_error( def test_call_no_input_with_called_process_error( - tmp_dir: str, tmp_venv: VirtualEnv, mocker: MockerFixture + tmp_path: Path, tmp_venv: VirtualEnv, mocker: MockerFixture ): mocker.patch( "subprocess.call", side_effect=subprocess.CalledProcessError(42, "some_command") @@ -1211,7 +1209,7 @@ def test_activate_with_in_project_setting_does_not_fail_if_no_venvs_dir( manager: EnvManager, poetry: Poetry, config: Config, - tmp_dir: str, + tmp_path: Path, mocker: MockerFixture, ): if "VIRTUAL_ENV" in os.environ: @@ -1220,7 +1218,7 @@ def test_activate_with_in_project_setting_does_not_fail_if_no_venvs_dir( config.merge( { "virtualenvs": { - "path": str(Path(tmp_dir) / "virtualenvs"), + "path": str(tmp_path / "virtualenvs"), "in-project": True, } } @@ -1250,7 +1248,7 @@ def test_activate_with_in_project_setting_does_not_fail_if_no_venvs_dir( prompt="simple-project-py3.7", ) - envs_file = TOMLFile(Path(tmp_dir) / "virtualenvs" / "envs.toml") + envs_file = TOMLFile(tmp_path / "virtualenvs" / "envs.toml") assert not envs_file.exists() @@ -1325,8 +1323,8 @@ def test_env_no_pip( assert installed_packages == packages -def test_env_finds_the_correct_executables(tmp_dir: str, manager: EnvManager): - venv_path = Path(tmp_dir) / "Virtual Env" +def test_env_finds_the_correct_executables(tmp_path: Path, manager: EnvManager): + venv_path = tmp_path / "Virtual Env" manager.build_venv(str(venv_path), with_pip=True) venv = VirtualEnv(venv_path) @@ -1356,10 +1354,10 @@ def test_env_finds_the_correct_executables(tmp_dir: str, manager: EnvManager): def test_env_finds_the_correct_executables_for_generic_env( - tmp_dir: str, manager: EnvManager + tmp_path: Path, manager: EnvManager ): - venv_path = Path(tmp_dir) / "Virtual Env" - child_venv_path = Path(tmp_dir) / "Child Virtual Env" + venv_path = tmp_path / "Virtual Env" + child_venv_path = tmp_path / "Child Virtual Env" manager.build_venv(str(venv_path), with_pip=True) parent_venv = VirtualEnv(venv_path) manager.build_venv( @@ -1383,10 +1381,10 @@ def test_env_finds_the_correct_executables_for_generic_env( def test_env_finds_fallback_executables_for_generic_env( - tmp_dir: str, manager: EnvManager + tmp_path: Path, manager: EnvManager ): - venv_path = Path(tmp_dir) / "Virtual Env" - child_venv_path = Path(tmp_dir) / "Child Virtual Env" + venv_path = tmp_path / "Virtual Env" + child_venv_path = tmp_path / "Child Virtual Env" manager.build_venv(str(venv_path), with_pip=True) parent_venv = VirtualEnv(venv_path) manager.build_venv( @@ -1487,7 +1485,7 @@ def test_create_venv_accepts_fallback_version_w_nonzero_patchlevel( def test_generate_env_name_ignores_case_for_case_insensitive_fs( poetry: Poetry, - tmp_dir: str, + tmp_path: Path, ): venv_name1 = EnvManager.generate_env_name(poetry.package.name, "MyDiR") venv_name2 = EnvManager.generate_env_name(poetry.package.name, "mYdIr") @@ -1497,7 +1495,7 @@ def test_generate_env_name_ignores_case_for_case_insensitive_fs( assert venv_name1 != venv_name2 -def test_generate_env_name_uses_real_path(tmp_dir: str, mocker: MockerFixture): +def test_generate_env_name_uses_real_path(tmp_path: Path, mocker: MockerFixture): mocker.patch("os.path.realpath", return_value="the_real_dir") venv_name1 = EnvManager.generate_env_name("simple-project", "the_real_dir") venv_name2 = EnvManager.generate_env_name("simple-project", "linked_dir") @@ -1514,10 +1512,10 @@ def extended_without_setup_poetry() -> Poetry: def test_build_environment_called_build_script_specified( - mocker: MockerFixture, extended_without_setup_poetry: Poetry, tmp_dir: str + mocker: MockerFixture, extended_without_setup_poetry: Poetry, tmp_path: Path ): - project_env = MockEnv(path=Path(tmp_dir) / "project") - ephemeral_env = MockEnv(path=Path(tmp_dir) / "ephemeral") + project_env = MockEnv(path=tmp_path / "project") + ephemeral_env = MockEnv(path=tmp_path / "ephemeral") mocker.patch( "poetry.utils.env.ephemeral_environment" @@ -1539,10 +1537,10 @@ def test_build_environment_called_build_script_specified( def test_build_environment_not_called_without_build_script_specified( - mocker: MockerFixture, poetry: Poetry, tmp_dir: str + mocker: MockerFixture, poetry: Poetry, tmp_path: Path ): - project_env = MockEnv(path=Path(tmp_dir) / "project") - ephemeral_env = MockEnv(path=Path(tmp_dir) / "ephemeral") + project_env = MockEnv(path=tmp_path / "project") + ephemeral_env = MockEnv(path=tmp_path / "ephemeral") mocker.patch( "poetry.utils.env.ephemeral_environment" diff --git a/tests/utils/test_env_site.py b/tests/utils/test_env_site.py index f3fdc9bb6d3..a8dc1c3d740 100644 --- a/tests/utils/test_env_site.py +++ b/tests/utils/test_env_site.py @@ -13,12 +13,12 @@ from pytest_mock import MockerFixture -def test_env_site_simple(tmp_dir: str, mocker: MockerFixture): +def test_env_site_simple(tmp_path: Path, mocker: MockerFixture): # emulate permission error when creating directory mocker.patch("pathlib.Path.mkdir", side_effect=OSError()) - site_packages = SitePackages(Path("/non-existent"), fallbacks=[Path(tmp_dir)]) + site_packages = SitePackages(Path("/non-existent"), fallbacks=[tmp_path]) candidates = site_packages.make_candidates(Path("hello.txt"), writable_only=True) - hello = Path(tmp_dir) / "hello.txt" + hello = tmp_path / "hello.txt" assert len(candidates) == 1 assert candidates[0].as_posix() == hello.as_posix() @@ -31,8 +31,8 @@ def test_env_site_simple(tmp_dir: str, mocker: MockerFixture): assert not (site_packages.path / "hello.txt").exists() -def test_env_site_select_first(tmp_dir: str): - path = Path(tmp_dir) +def test_env_site_select_first(tmp_path: Path): + path = tmp_path fallback = path / "fallback" fallback.mkdir(parents=True) diff --git a/tests/utils/test_pip.py b/tests/utils/test_pip.py index c6bf8422538..a7cf7eb7eba 100644 --- a/tests/utils/test_pip.py +++ b/tests/utils/test_pip.py @@ -16,9 +16,7 @@ from tests.types import FixtureDirGetter -def test_pip_install_successful( - tmp_dir: str, tmp_venv: VirtualEnv, fixture_dir: FixtureDirGetter -): +def test_pip_install_successful(tmp_venv: VirtualEnv, fixture_dir: FixtureDirGetter): file_path = fixture_dir("distributions/demo-0.1.0-py2.py3-none-any.whl") result = pip_install(file_path, tmp_venv) @@ -26,7 +24,6 @@ def test_pip_install_successful( def test_pip_install_with_keyboard_interrupt( - tmp_dir: str, tmp_venv: VirtualEnv, fixture_dir: FixtureDirGetter, mocker: MockerFixture,