Skip to content

Commit

Permalink
split up fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
adriangb committed May 18, 2023
1 parent 93fd76b commit d048899
Show file tree
Hide file tree
Showing 11 changed files with 156 additions and 38 deletions.
5 changes: 3 additions & 2 deletions tests/console/commands/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,10 @@ def test_install_logs_output_decorated(

@pytest.mark.parametrize("options", ["", "--without dev"])
@pytest.mark.parametrize(
"project", ["missing_directory_dependency", "missing_file_dependency"]
"project",
["missing_directory_dependency_from_group", "missing_file_dependency_from_group"],
)
def test_install_path_dependency_does_not_exist(
def test_install__dependency_does_not_exist(
command_tester_factory: CommandTesterFactory,
project_factory: ProjectFactory,
fixture_dir: FixtureDirGetter,
Expand Down
27 changes: 0 additions & 27 deletions tests/console/commands/test_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,33 +261,6 @@ def test_lock_path_dependency_deleted_from_pyproject(
assert {p.name for p in packages} == set()


@pytest.mark.parametrize("update", [True, False])
def test_lock_missing_transitive_directory_dependency(
command_tester_factory: CommandTesterFactory,
project_factory: ProjectFactory,
fixture_dir: FixtureDirGetter,
update: bool,
) -> None:
project = "missing_transitive_directory_dependency"
poetry = _project_factory(project, project_factory, fixture_dir)
locker = Locker(
lock=poetry.pyproject.file.path.parent / "poetry.lock",
local_config=poetry.locker._local_config,
)
poetry.set_locker(locker)

tester = command_tester_factory("lock", poetry=poetry)

with pytest.raises(
ValueError,
match=r"Path .*foo for foo does not exist",
):
if update:
tester.execute("")
else:
tester.execute("--no-update")


@pytest.mark.parametrize("is_no_update", [False, True])
def test_lock_with_incompatible_lockfile(
command_tester_factory: CommandTesterFactory,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[tool.poetry]
name = "missing"
version = "1.0.0"
description = "This is a description"
authors = ["Your Name <you@example.com>"]
license = "MIT"
packages = []

[tool.poetry.dependencies]
python = "*"
pendulum = "1.4.4"
98 changes: 95 additions & 3 deletions tests/fixtures/missing_directory_dependency/poetry.lock

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

2 changes: 0 additions & 2 deletions tests/fixtures/missing_directory_dependency/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ packages = []

[tool.poetry.dependencies]
python = "*"

[tool.poetry.dev-dependencies]
missing = { path = "./missing" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[tool.poetry]
name = "missing"
version = "1.0.0"
description = "This is a description"
authors = ["Your Name <you@example.com>"]
license = "MIT"
packages = []

[tool.poetry.dependencies]
python = "*"
20 changes: 20 additions & 0 deletions tests/fixtures/missing_directory_dependency_from_group/poetry.lock

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[tool.poetry]
name = "project-with-missing-directory-dependency-from-group"
version = "1.2.3"
description = "This is a description"
authors = ["Your Name <you@example.com>"]
license = "MIT"
packages = []

[tool.poetry.dependencies]
python = "*"

[tool.poetry.dev-dependencies]
missing = { path = "./missing" }
8 changes: 4 additions & 4 deletions tests/installation/test_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1330,16 +1330,16 @@ def test_run_installs_with_skip_directory_flag_target_does_not_exist(
"""
root_dir = fixture_dir("")
package.root_dir = root_dir
directory = root_dir.joinpath("missing_transitive_directory_dependency")
directory = root_dir.joinpath("missing_directory_dependency")
locker.set_lock_path(directory)
locker.locked(locked)
dep_name = "project-with-transitive-directory-dependencies-missing"
dep_name = "project-with-missing-directory-dependency"
package.add_dependency(
Factory.create_dependency(
dep_name,
{"path": str(directory.relative_to(root_dir))},
root_dir=root_dir,
)
),
)

repo.add_package(get_package("pendulum", "1.4.4"))
Expand All @@ -1361,7 +1361,7 @@ def test_run_installs_with_skip_directory_flag_target_does_not_exist(
else:
with pytest.raises(
ValueError,
match=r"Path .*foo for foo does not exist",
match=r"Path .*missing for missing does not exist",
):
installer.run()

Expand Down

0 comments on commit d048899

Please sign in to comment.