Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
f9c54c6c
Commit
f9c54c6c
authored
Mar 22, 2022
by
Arun Babu Neelicattu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: add coverage for --no-root when using groups
parent
7ad55b5c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
3 deletions
+25
-3
tests/console/commands/test_install.py
+25
-3
No files found.
tests/console/commands/test_install.py
View file @
f9c54c6c
...
...
@@ -4,6 +4,8 @@ from typing import TYPE_CHECKING
import
pytest
from
poetry.core.masonry.utils.module
import
ModuleOrPackageNotFound
if
TYPE_CHECKING
:
from
cleo.testers.command_tester
import
CommandTester
...
...
@@ -61,8 +63,10 @@ def tester(
@pytest.mark.parametrize
(
(
"options"
,
"groups"
),
(
"options"
,
"groups"
,
"with_root"
),
[
case
+
(
with_root
,)
for
case
in
[
(
""
,
{
"default"
,
"foo"
,
"bar"
,
"baz"
,
"bim"
}),
(
"--only default"
,
{
"default"
}),
(
"--only foo"
,
{
"foo"
}),
...
...
@@ -71,15 +75,27 @@ def tester(
(
"--with bam"
,
{
"default"
,
"foo"
,
"bar"
,
"baz"
,
"bim"
,
"bam"
}),
(
"--without foo,bar"
,
{
"default"
,
"baz"
,
"bim"
}),
(
"--with foo,bar --without baz --without bim --only bam"
,
{
"bam"
}),
]
for
with_root
in
{
True
,
False
}
],
)
def
test_group_options_are_passed_to_the_installer
(
options
:
str
,
groups
:
set
[
str
],
tester
:
CommandTester
,
mocker
:
MockerFixture
options
:
str
,
groups
:
set
[
str
],
with_root
:
bool
,
tester
:
CommandTester
,
mocker
:
MockerFixture
,
):
"""
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
=
0
)
editable_builder_mock
=
mocker
.
patch
(
"poetry.masonry.builders.EditableBuilder"
,
side_effect
=
ModuleOrPackageNotFound
()
)
if
not
with_root
:
options
=
f
"--no-root {options}"
tester
.
execute
(
options
)
...
...
@@ -89,6 +105,12 @@ def test_group_options_are_passed_to_the_installer(
assert
installer_groups
<=
package_groups
assert
set
(
installer_groups
)
==
groups
if
with_root
:
assert
editable_builder_mock
.
call_count
==
1
assert
editable_builder_mock
.
call_args_list
[
0
][
0
][
0
]
==
tester
.
command
.
poetry
else
:
assert
editable_builder_mock
.
call_count
==
0
def
test_sync_option_is_passed_to_the_installer
(
tester
:
CommandTester
,
mocker
:
MockerFixture
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment