Skip to content

Commit

Permalink
Don't fail on skipped file/dir dependencies (#8549)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pwuts authored Nov 19, 2023
1 parent 6cdc889 commit 2900107
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/poetry/installation/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def _do_install(self) -> int:
dep = op.package.to_dependency()
if dep.is_file() or dep.is_directory():
dep = cast("PathDependency", dep)
dep.validate(raise_error=True)
dep.validate(raise_error=not op.skipped)

# Execute operations
status = self._execute(ops)
Expand Down
19 changes: 19 additions & 0 deletions tests/console/commands/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,25 @@ def test_install_path_dependency_does_not_exist(
tester.execute(options)


@pytest.mark.parametrize("options", ["", "--extras notinstallable"])
def test_install_extra_path_dependency_does_not_exist(
command_tester_factory: CommandTesterFactory,
project_factory: ProjectFactory,
fixture_dir: FixtureDirGetter,
options: str,
) -> None:
project = "missing_extra_directory_dependency"
poetry = _project_factory(project, project_factory, fixture_dir)
assert isinstance(poetry.locker, TestLocker)
poetry.locker.locked(True)
tester = command_tester_factory("install", poetry=poetry)
if not options:
tester.execute(options)
else:
with pytest.raises(ValueError, match="does not exist"):
tester.execute(options)


@pytest.mark.parametrize("options", ["", "--no-directory"])
def test_install_missing_directory_dependency_with_no_directory(
command_tester_factory: CommandTesterFactory,
Expand Down
22 changes: 22 additions & 0 deletions tests/fixtures/missing_extra_directory_dependency/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions tests/fixtures/missing_extra_directory_dependency/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[tool.poetry]
name = "project-with-missing-extra-directory-dependency"
version = "1.2.3"
description = "This is a description"
authors = ["Your Name <you@example.com>"]
license = "MIT"
packages = []

[tool.poetry.dependencies]
python = "*"
missing = { path = "./missing", optional = true }

[tool.poetry.extras]
notinstallable = ["missing"]

0 comments on commit 2900107

Please sign in to comment.