Commit 20b0a490 by Arun Babu Neelicattu

tests: improve install command group opt coverage

parent c83bb94c
...@@ -40,6 +40,9 @@ baz = "^1.2" ...@@ -40,6 +40,9 @@ baz = "^1.2"
[tool.poetry.group.bim.dependencies] [tool.poetry.group.bim.dependencies]
bim = "^1.3" bim = "^1.3"
[tool.poetry.group.bam]
optional = true
[tool.poetry.group.bam.dependencies] [tool.poetry.group.bam.dependencies]
bam = "^1.4" bam = "^1.4"
""" """
...@@ -57,21 +60,34 @@ def tester( ...@@ -57,21 +60,34 @@ def tester(
return command_tester_factory("install") return command_tester_factory("install")
@pytest.mark.parametrize(
("options", "groups"),
[
("", {"default", "foo", "bar", "baz", "bim"}),
("--only default", {"default"}),
("--only foo", {"foo"}),
("--only foo,bar", {"foo", "bar"}),
("--only bam", {"bam"}),
("--with bam", {"default", "foo", "bar", "baz", "bim", "bam"}),
("--without foo,bar", {"default", "baz", "bim"}),
("--with foo,bar --without baz --without bim --only bam", {"bam"}),
],
)
def test_group_options_are_passed_to_the_installer( def test_group_options_are_passed_to_the_installer(
tester: CommandTester, mocker: MockerFixture options: str, groups: set[str], tester: CommandTester, mocker: MockerFixture
): ):
""" """
Group options are passed properly to the installer. Group options are passed properly to the installer.
""" """
mocker.patch.object(tester.command.installer, "run", return_value=1) mocker.patch.object(tester.command.installer, "run", return_value=1)
tester.execute("--with foo,bar --without baz --without bim --only bam") tester.execute(options)
package_groups = set(tester.command.poetry.package._dependency_groups.keys()) package_groups = set(tester.command.poetry.package._dependency_groups.keys())
installer_groups = set(tester.command.installer._groups) installer_groups = set(tester.command.installer._groups)
assert installer_groups <= package_groups assert installer_groups <= package_groups
assert set(installer_groups) == {"bam"} assert set(installer_groups) == groups
def test_sync_option_is_passed_to_the_installer( def test_sync_option_is_passed_to_the_installer(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment