diff --git a/poetry.lock b/poetry.lock
index f24998dc401..7562bdb1d34 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -1077,14 +1077,14 @@ testing = ["pytest", "pytest-benchmark"]
[[package]]
name = "poetry-core"
-version = "1.5.2"
+version = "1.6.0"
description = "Poetry PEP 517 Build Backend"
category = "main"
optional = false
python-versions = ">=3.7,<4.0"
files = [
- {file = "poetry_core-1.5.2-py3-none-any.whl", hash = "sha256:832d40a1ea5fd10c0f648d0575cadddc8b79f06f91d83a1f1a73a7e1dfacfbd7"},
- {file = "poetry_core-1.5.2.tar.gz", hash = "sha256:c6556c3b1ec5b8668e6ef5a4494726bc41d31907339425e194e78a6178436c14"},
+ {file = "poetry_core-1.6.0-py3-none-any.whl", hash = "sha256:ff96620579f02ec30ee9f789fa5dfdcddd9ab4ac848394f6f8f2f4e88306b534"},
+ {file = "poetry_core-1.6.0.tar.gz", hash = "sha256:a9c7296a12d6c8e4f8aa50a66ef3c967b2b50fba634da144d358e676fad9989f"},
]
[package.dependencies]
@@ -1616,14 +1616,14 @@ files = [
[[package]]
name = "tomlkit"
-version = "0.11.6"
+version = "0.11.8"
description = "Style preserving TOML library"
category = "main"
optional = false
-python-versions = ">=3.6"
+python-versions = ">=3.7"
files = [
- {file = "tomlkit-0.11.6-py3-none-any.whl", hash = "sha256:07de26b0d8cfc18f871aec595fda24d95b08fef89d147caa861939f37230bf4b"},
- {file = "tomlkit-0.11.6.tar.gz", hash = "sha256:71b952e5721688937fb02cf9d354dbcf0785066149d2855e44531ebdd2b65d73"},
+ {file = "tomlkit-0.11.8-py3-none-any.whl", hash = "sha256:8c726c4c202bdb148667835f68d68780b9a003a9ec34167b6c673b38eff2a171"},
+ {file = "tomlkit-0.11.8.tar.gz", hash = "sha256:9330fc7faa1db67b541b28e62018c17d20be733177d290a13b24c62d1614e0c3"},
]
[[package]]
@@ -1890,4 +1890,4 @@ testing = ["flake8 (<5)", "func-timeout", "jaraco.functools", "jaraco.itertools"
[metadata]
lock-version = "2.0"
python-versions = "^3.7"
-content-hash = "9aaf819933593fe3f84ff37db4ed316090da9b491e66fd5108b2b33f32f683c3"
+content-hash = "430ba3f08c5c3422c311d9bd03544aaf381c2ab10de8bb8bc79e87d1951d6cc1"
diff --git a/pyproject.toml b/pyproject.toml
index 2af406fefc9..2fde185b21a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -32,7 +32,7 @@ Changelog = "https://python-poetry.org/history/"
[tool.poetry.dependencies]
python = "^3.7"
-poetry-core = "1.5.2"
+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"
diff --git a/src/poetry/config/file_config_source.py b/src/poetry/config/file_config_source.py
index b3ccbb2f925..0f7c2a71605 100644
--- a/src/poetry/config/file_config_source.py
+++ b/src/poetry/config/file_config_source.py
@@ -82,7 +82,7 @@ def secure(self) -> Iterator[TOMLDocument]:
mode = 0o600
if new_file:
- self.file.touch(mode=mode)
+ self.file.path.touch(mode=mode)
self.file.write(config)
except Exception:
diff --git a/src/poetry/console/commands/add.py b/src/poetry/console/commands/add.py
index 9fda60fbc7e..2db11dfb0c1 100644
--- a/src/poetry/console/commands/add.py
+++ b/src/poetry/console/commands/add.py
@@ -249,7 +249,7 @@ def handle(self) -> int:
constraint_name,
constraint,
groups=[group],
- root_dir=self.poetry.file.parent,
+ root_dir=self.poetry.file.path.parent,
)
)
diff --git a/src/poetry/console/commands/config.py b/src/poetry/console/commands/config.py
index 0ec466aefd2..eed7cad4474 100644
--- a/src/poetry/console/commands/config.py
+++ b/src/poetry/console/commands/config.py
@@ -95,7 +95,7 @@ def handle(self) -> int:
config_file = TOMLFile(CONFIG_DIR / "config.toml")
try:
- local_config_file = TOMLFile(self.poetry.file.parent / "poetry.toml")
+ local_config_file = TOMLFile(self.poetry.file.path.parent / "poetry.toml")
if local_config_file.exists():
config.merge(local_config_file.read())
except (RuntimeError, PyProjectException):
@@ -106,7 +106,7 @@ def handle(self) -> int:
if not config_file.exists():
config_file.path.parent.mkdir(parents=True, exist_ok=True)
- config_file.touch(mode=0o0600)
+ config_file.path.touch(mode=0o0600)
if self.option("list"):
self._list_configuration(config.all(), config.raw())
diff --git a/src/poetry/console/commands/init.py b/src/poetry/console/commands/init.py
index 54c0af92bd7..8424f90b60e 100644
--- a/src/poetry/console/commands/init.py
+++ b/src/poetry/console/commands/init.py
@@ -433,7 +433,7 @@ def _parse_requirements(self, requirements: list[str]) -> list[dict[str, Any]]:
from poetry.core.pyproject.exceptions import PyProjectException
try:
- cwd = self.poetry.file.parent
+ cwd = self.poetry.file.path.parent
artifact_cache = self.poetry.pool.artifact_cache
except (PyProjectException, RuntimeError):
cwd = Path.cwd()
diff --git a/src/poetry/console/commands/run.py b/src/poetry/console/commands/run.py
index 5b008a2fc53..98736280bf2 100644
--- a/src/poetry/console/commands/run.py
+++ b/src/poetry/console/commands/run.py
@@ -40,7 +40,7 @@ def _module(self) -> Module:
poetry = self.poetry
package = poetry.package
- path = poetry.file.parent
+ path = poetry.file.path.parent
module = Module(package.name, path.as_posix(), package.packages)
return module
diff --git a/src/poetry/console/commands/show.py b/src/poetry/console/commands/show.py
index c8c1fbc3595..090e5ca17a7 100644
--- a/src/poetry/console/commands/show.py
+++ b/src/poetry/console/commands/show.py
@@ -267,7 +267,7 @@ def _display_packages_information(
version_length,
len(
get_package_version_display_string(
- locked, root=self.poetry.file.parent
+ locked, root=self.poetry.file.path.parent
)
),
)
@@ -275,7 +275,7 @@ def _display_packages_information(
latest_length,
len(
get_package_version_display_string(
- latest, root=self.poetry.file.parent
+ latest, root=self.poetry.file.path.parent
)
),
)
@@ -292,7 +292,7 @@ def _display_packages_information(
version_length,
len(
get_package_version_display_string(
- locked, root=self.poetry.file.parent
+ locked, root=self.poetry.file.path.parent
)
),
)
@@ -353,7 +353,7 @@ def _display_packages_information(
)
if write_version:
version = get_package_version_display_string(
- locked, root=self.poetry.file.parent
+ locked, root=self.poetry.file.path.parent
)
line += f" {version:{version_length}}"
if show_latest:
@@ -368,7 +368,7 @@ def _display_packages_information(
color = "yellow"
version = get_package_version_display_string(
- latest, root=self.poetry.file.parent
+ latest, root=self.poetry.file.path.parent
)
line += f" {version:{latest_length}}>"
diff --git a/src/poetry/factory.py b/src/poetry/factory.py
index c79135d1077..5e926b6177a 100644
--- a/src/poetry/factory.py
+++ b/src/poetry/factory.py
@@ -57,12 +57,7 @@ def create_poetry(
base_poetry = super().create_poetry(cwd=cwd, with_groups=with_groups)
- # TODO: backward compatibility, can be simplified if poetry-core with
- # https://github.com/python-poetry/poetry-core/pull/483 is available
- poetry_file: Path = (
- getattr(base_poetry, "pyproject_path", None) or base_poetry.file.path
- )
-
+ poetry_file = base_poetry.pyproject_path
locker = Locker(poetry_file.parent / "poetry.lock", base_poetry.local_config)
# Loading global configuration
diff --git a/src/poetry/layouts/layout.py b/src/poetry/layouts/layout.py
index 45fcb28b6a5..85733a7bef6 100644
--- a/src/poetry/layouts/layout.py
+++ b/src/poetry/layouts/layout.py
@@ -91,13 +91,10 @@ def get_package_include(self) -> InlineTable | None:
return None
include = parts[0]
- package.append("include", include) # type: ignore[no-untyped-call]
+ package.append("include", include)
if self.basedir != Path():
- package.append( # type: ignore[no-untyped-call]
- "from",
- self.basedir.as_posix(),
- )
+ package.append("from", self.basedir.as_posix())
else:
if include == self._project:
# package include and package name are the same,
diff --git a/src/poetry/masonry/builders/editable.py b/src/poetry/masonry/builders/editable.py
index 81d577b1445..7eb438ad3c8 100644
--- a/src/poetry/masonry/builders/editable.py
+++ b/src/poetry/masonry/builders/editable.py
@@ -105,7 +105,7 @@ def _setup_build(self) -> None:
pip_install(self._path, self._env, upgrade=True, editable=True)
else:
# Temporarily rename pyproject.toml
- renamed_pyproject = self._poetry.file.with_suffix(".tmp")
+ renamed_pyproject = self._poetry.file.path.with_suffix(".tmp")
self._poetry.file.path.rename(renamed_pyproject)
try:
pip_install(self._path, self._env, upgrade=True, editable=True)
@@ -130,7 +130,7 @@ def _add_pth(self) -> list[Path]:
for file in self._env.site_packages.find(path=pth_file, writable_only=True):
self._debug(
f" - Removing existing {file.name} from {file.parent}"
- f" for {self._poetry.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():
@@ -142,14 +142,14 @@ def _add_pth(self) -> list[Path]:
)
self._debug(
f" - Adding {pth_file.name} to {pth_file.parent} for"
- f" {self._poetry.file.parent}"
+ f" {self._poetry.file.path.parent}"
)
return [pth_file]
except OSError:
# TODO: Replace with PermissionError
self._io.write_error_line(
f" - Failed to create {pth_file.name} for"
- f" {self._poetry.file.parent}"
+ f" {self._poetry.file.path.parent}"
)
return []
@@ -163,7 +163,7 @@ def _add_scripts(self) -> list[Path]:
else:
self._io.write_error_line(
" - Failed to find a suitable script installation directory for"
- f" {self._poetry.file.parent}"
+ f" {self._poetry.file.path.parent}"
)
return []
diff --git a/src/poetry/poetry.py b/src/poetry/poetry.py
index 57c05b3e540..dfbe043594c 100644
--- a/src/poetry/poetry.py
+++ b/src/poetry/poetry.py
@@ -37,15 +37,7 @@ def __init__(
) -> None:
from poetry.repositories.repository_pool import RepositoryPool
- try:
- super().__init__( # type: ignore[call-arg]
- file, local_config, package, pyproject_type=PyProjectTOML
- )
- except TypeError:
- # TODO: backward compatibility, can be simplified if poetry-core with
- # https://github.com/python-poetry/poetry-core/pull/483 is available
- super().__init__(file, local_config, package)
- self._pyproject = PyProjectTOML(file)
+ super().__init__(file, local_config, package, pyproject_type=PyProjectTOML)
self._locker = locker
self._config = config
@@ -59,7 +51,7 @@ def pyproject(self) -> PyProjectTOML:
return cast("PyProjectTOML", pyproject)
@property
- def file(self) -> TOMLFile: # type: ignore[override]
+ def file(self) -> TOMLFile:
return self.pyproject.file
@property
diff --git a/src/poetry/publishing/uploader.py b/src/poetry/publishing/uploader.py
index 256fd235259..42cf1f459a7 100644
--- a/src/poetry/publishing/uploader.py
+++ b/src/poetry/publishing/uploader.py
@@ -77,7 +77,7 @@ def adapter(self) -> adapters.HTTPAdapter:
@property
def files(self) -> list[Path]:
- dist = self._poetry.file.parent / "dist"
+ dist = self._poetry.file.path.parent / "dist"
version = self._package.version.to_string()
escaped_name = distribution_name(self._package.name)
@@ -301,7 +301,7 @@ def _register(self, session: requests.Session, url: str) -> requests.Response:
"""
Register a package to a repository.
"""
- dist = self._poetry.file.parent / "dist"
+ dist = self._poetry.file.path.parent / "dist"
escaped_name = distribution_name(self._package.name)
file = dist / f"{escaped_name}-{self._package.version.to_string()}.tar.gz"
diff --git a/src/poetry/pyproject/toml.py b/src/poetry/pyproject/toml.py
index 3e9010b4c85..77a9be55a9a 100644
--- a/src/poetry/pyproject/toml.py
+++ b/src/poetry/pyproject/toml.py
@@ -29,7 +29,7 @@ def __init__(self, path: Path) -> None:
self._toml_document: TOMLDocument | None = None
@property
- def file(self) -> TOMLFile: # type: ignore[override]
+ def file(self) -> TOMLFile:
return self._toml_file
@property
diff --git a/src/poetry/repositories/installed_repository.py b/src/poetry/repositories/installed_repository.py
index d8ff78c8455..4256c509beb 100644
--- a/src/poetry/repositories/installed_repository.py
+++ b/src/poetry/repositories/installed_repository.py
@@ -247,9 +247,7 @@ def load(cls, env: Env, with_dependencies: bool = False) -> InstalledRepository:
continue
for distribution in sorted(
- metadata.distributions( # type: ignore[no-untyped-call]
- path=[entry],
- ),
+ metadata.distributions(path=[entry]),
key=lambda d: str(d._path), # type: ignore[attr-defined]
):
path = Path(str(distribution._path)) # type: ignore[attr-defined]
diff --git a/src/poetry/toml/file.py b/src/poetry/toml/file.py
index 79c2e018419..8c5bf729276 100644
--- a/src/poetry/toml/file.py
+++ b/src/poetry/toml/file.py
@@ -1,5 +1,7 @@
from __future__ import annotations
+import warnings
+
from typing import TYPE_CHECKING
from typing import Any
@@ -35,6 +37,15 @@ def read(self) -> TOMLDocument:
raise TOMLError(f"Invalid TOML file {self.path.as_posix()}: {e}")
def __getattr__(self, item: str) -> Any:
+ warnings.warn(
+ (
+ "`__getattr__` will be removed from the `TOMLFile` in a future release."
+ "\n\nInstead of accessing properties of the underlying `Path` as "
+ "`tomlfile.whatever`, prefer `tomlfile.path.whatever`."
+ ),
+ DeprecationWarning,
+ stacklevel=2,
+ )
return getattr(self.__path, item)
def __str__(self) -> str:
diff --git a/src/poetry/utils/env.py b/src/poetry/utils/env.py
index 5122d69a597..52f3f8fa690 100644
--- a/src/poetry/utils/env.py
+++ b/src/poetry/utils/env.py
@@ -289,10 +289,7 @@ def distributions(
)
)
- yield from metadata.PathDistribution.discover( # type: ignore[no-untyped-call]
- name=name,
- path=path,
- )
+ yield from metadata.PathDistribution.discover(name=name, path=path)
def find_distribution(
self, name: str, writable_only: bool = False
@@ -310,9 +307,7 @@ def find_distribution_files_with_suffix(
files = [] if distribution.files is None else distribution.files
for file in files:
if file.name.endswith(suffix):
- yield Path(
- distribution.locate_file(file), # type: ignore[no-untyped-call]
- )
+ yield Path(distribution.locate_file(file))
def find_distribution_files_with_name(
self, distribution_name: str, name: str, writable_only: bool = False
@@ -323,18 +318,7 @@ def find_distribution_files_with_name(
files = [] if distribution.files is None else distribution.files
for file in files:
if file.name == name:
- yield Path(
- distribution.locate_file(file), # type: ignore[no-untyped-call]
- )
-
- def find_distribution_nspkg_pth_files(
- self, distribution_name: str, writable_only: bool = False
- ) -> Iterable[Path]:
- return self.find_distribution_files_with_suffix(
- distribution_name=distribution_name,
- suffix="-nspkg.pth",
- writable_only=writable_only,
- )
+ yield Path(distribution.locate_file(file))
def find_distribution_direct_url_json_files(
self, distribution_name: str, writable_only: bool = False
@@ -353,9 +337,8 @@ 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), # type: ignore[no-untyped-call]
- )
+ 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()
@@ -571,12 +554,12 @@ def get_python_version(
@property
def in_project_venv(self) -> Path:
- venv: Path = self._poetry.file.parent / ".venv"
+ venv: Path = self._poetry.file.path.parent / ".venv"
return venv
def activate(self, python: str) -> Env:
venv_path = self._poetry.config.virtualenvs_path
- cwd = self._poetry.file.parent
+ cwd = self._poetry.file.path.parent
envs_file = TOMLFile(venv_path / self.ENVS_FILE)
@@ -665,7 +648,7 @@ def activate(self, python: str) -> Env:
def deactivate(self) -> None:
venv_path = self._poetry.config.virtualenvs_path
name = self.generate_env_name(
- self._poetry.package.name, str(self._poetry.file.parent)
+ self._poetry.package.name, str(self._poetry.file.path.parent)
)
envs_file = TOMLFile(venv_path / self.ENVS_FILE)
@@ -694,7 +677,7 @@ def get(self, reload: bool = False) -> Env:
venv_path = self._poetry.config.virtualenvs_path
- cwd = self._poetry.file.parent
+ cwd = self._poetry.file.path.parent
envs_file = TOMLFile(venv_path / self.ENVS_FILE)
env = None
base_env_name = self.generate_env_name(self._poetry.package.name, str(cwd))
@@ -749,7 +732,7 @@ def list(self, name: str | None = None) -> list[VirtualEnv]:
if name is None:
name = self._poetry.package.name
- venv_name = self.generate_env_name(name, str(self._poetry.file.parent))
+ venv_name = self.generate_env_name(name, str(self._poetry.file.path.parent))
venv_path = self._poetry.config.virtualenvs_path
env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))]
@@ -770,7 +753,7 @@ def check_env_is_for_current_project(env: str, base_env_name: str) -> bool:
def remove(self, python: str) -> Env:
venv_path = self._poetry.config.virtualenvs_path
- cwd = self._poetry.file.parent
+ cwd = self._poetry.file.path.parent
envs_file = TOMLFile(venv_path / self.ENVS_FILE)
base_env_name = self.generate_env_name(self._poetry.package.name, str(cwd))
@@ -883,7 +866,7 @@ def create_venv(
if self._env is not None and not force:
return self._env
- cwd = self._poetry.file.parent
+ cwd = self._poetry.file.path.parent
env = self.get(reload=True)
if not env.is_sane():
diff --git a/tests/console/commands/env/conftest.py b/tests/console/commands/env/conftest.py
index 4f613248cc0..f118b5f05f1 100644
--- a/tests/console/commands/env/conftest.py
+++ b/tests/console/commands/env/conftest.py
@@ -20,7 +20,7 @@
def venv_name(app: PoetryTestApplication) -> str:
return EnvManager.generate_env_name(
app.poetry.package.name,
- str(app.poetry.file.parent),
+ str(app.poetry.file.path.parent),
)
@@ -58,7 +58,7 @@ def venvs_in_cache_dirs(
@pytest.fixture
def venvs_in_project_dir(app: PoetryTestApplication) -> Iterator[Path]:
os.environ.pop("VIRTUAL_ENV", None)
- venv_dir = app.poetry.file.parent.joinpath(".venv")
+ venv_dir = app.poetry.file.path.parent.joinpath(".venv")
venv_dir.mkdir(exist_ok=True)
app.poetry.config.merge({"virtualenvs": {"in-project": True}})
@@ -71,7 +71,7 @@ def venvs_in_project_dir(app: PoetryTestApplication) -> Iterator[Path]:
@pytest.fixture
def venvs_in_project_dir_none(app: PoetryTestApplication) -> Iterator[Path]:
os.environ.pop("VIRTUAL_ENV", None)
- venv_dir = app.poetry.file.parent.joinpath(".venv")
+ venv_dir = app.poetry.file.path.parent.joinpath(".venv")
venv_dir.mkdir(exist_ok=True)
app.poetry.config.merge({"virtualenvs": {"in-project": None}})
@@ -84,7 +84,7 @@ def venvs_in_project_dir_none(app: PoetryTestApplication) -> Iterator[Path]:
@pytest.fixture
def venvs_in_project_dir_false(app: PoetryTestApplication) -> Iterator[Path]:
os.environ.pop("VIRTUAL_ENV", None)
- venv_dir = app.poetry.file.parent.joinpath(".venv")
+ venv_dir = app.poetry.file.path.parent.joinpath(".venv")
venv_dir.mkdir(exist_ok=True)
app.poetry.config.merge({"virtualenvs": {"in-project": False}})
diff --git a/tests/masonry/builders/test_editable_builder.py b/tests/masonry/builders/test_editable_builder.py
index 546e5e44727..363bb397607 100644
--- a/tests/masonry/builders/test_editable_builder.py
+++ b/tests/masonry/builders/test_editable_builder.py
@@ -95,7 +95,7 @@ def test_builder_installs_proper_files_for_standard_packages(
pth_file = Path("simple_project.pth")
assert tmp_venv.site_packages.exists(pth_file)
assert (
- simple_poetry.file.parent.resolve().as_posix()
+ simple_poetry.file.path.parent.resolve().as_posix()
== tmp_venv.site_packages.find(pth_file)[0].read_text().strip(os.linesep)
)
@@ -281,7 +281,7 @@ def test_builder_installs_proper_files_when_packages_configured(
if line:
paths.add(line)
- project_root = project_with_include.file.parent.resolve()
+ project_root = project_with_include.file.path.parent.resolve()
expected = {project_root.as_posix(), project_root.joinpath("src").as_posix()}
assert paths.issubset(expected)
@@ -339,5 +339,5 @@ def test_builder_should_execute_build_scripts(
builder.build()
assert [
- ["python", str(extended_without_setup_poetry.file.parent / "build.py")]
+ ["python", str(extended_without_setup_poetry.file.path.parent / "build.py")]
] == env.executed
diff --git a/tests/pyproject/test_pyproject_toml_file.py b/tests/pyproject/test_pyproject_toml_file.py
index 1c7c02a1439..5cb1b8c4327 100644
--- a/tests/pyproject/test_pyproject_toml_file.py
+++ b/tests/pyproject/test_pyproject_toml_file.py
@@ -25,4 +25,5 @@ def test_pyproject_toml_file_invalid(pyproject_toml: Path) -> None:
def test_pyproject_toml_file_getattr(tmp_path: Path, pyproject_toml: Path) -> None:
file = TOMLFile(pyproject_toml)
- assert file.parent == tmp_path
+ with pytest.warns(DeprecationWarning):
+ assert file.parent == tmp_path
diff --git a/tests/utils/conftest.py b/tests/utils/conftest.py
index 8ad174758c4..e9ec0be1ccf 100644
--- a/tests/utils/conftest.py
+++ b/tests/utils/conftest.py
@@ -17,5 +17,5 @@ def venv_name(
) -> str:
return manager.generate_env_name(
poetry.package.name,
- str(poetry.file.parent),
+ str(poetry.file.path.parent),
)
diff --git a/tests/utils/test_env.py b/tests/utils/test_env.py
index 6c5a17c4535..2022bbbd549 100644
--- a/tests/utils/test_env.py
+++ b/tests/utils/test_env.py
@@ -157,7 +157,7 @@ def test_env_get_supported_tags_matches_inside_virtualenv(
@pytest.fixture
def in_project_venv_dir(poetry: Poetry) -> Iterator[Path]:
os.environ.pop("VIRTUAL_ENV", None)
- venv_dir = poetry.file.parent.joinpath(".venv")
+ venv_dir = poetry.file.path.parent.joinpath(".venv")
venv_dir.mkdir()
try:
yield venv_dir
@@ -842,7 +842,7 @@ def test_raises_if_acting_on_different_project_by_name(
different_venv_name = (
EnvManager.generate_env_name(
"different-project",
- str(poetry.file.parent),
+ str(poetry.file.path.parent),
)
+ "-py3.6"
)
@@ -1344,7 +1344,9 @@ def test_create_venv_uses_patch_version_to_detect_compatibility_with_executable(
version = Version.from_parts(*sys.version_info[:3])
assert version.minor is not None
poetry.package.python_versions = f"~{version.major}.{version.minor - 1}.0"
- venv_name = manager.generate_env_name("simple-project", str(poetry.file.parent))
+ venv_name = manager.generate_env_name(
+ "simple-project", str(poetry.file.path.parent)
+ )
check_output = mocker.patch(
"subprocess.check_output",
@@ -1433,7 +1435,7 @@ def test_activate_with_in_project_setting_does_not_fail_if_no_venvs_dir(
manager.activate("python3.7")
m.assert_called_with(
- poetry.file.parent / ".venv",
+ poetry.file.path.parent / ".venv",
executable=Path("/usr/bin/python3.7"),
flags={
"always-copy": False,
@@ -1772,7 +1774,7 @@ def test_create_venv_project_name_empty_sets_correct_prompt(
manager = EnvManager(poetry)
poetry.package.python_versions = "^3.7"
- venv_name = manager.generate_env_name("", str(poetry.file.parent))
+ venv_name = manager.generate_env_name("", str(poetry.file.path.parent))
mocker.patch("sys.version_info", (2, 7, 16))
mocker.patch("shutil.which", side_effect=lambda py: f"/usr/bin/{py}")