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
8ef2a645
Commit
8ef2a645
authored
May 29, 2022
by
Ashwin Nair
Committed by
Randy Döring
Aug 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for git urls with subdirectory
parent
49b1fb29
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
113 additions
and
1 deletions
+113
-1
tests/console/commands/self/test_add_plugins.py
+47
-0
tests/console/commands/test_add.py
+47
-0
tests/fixtures/git/github.com/demo/poetry-plugin2/subdir/poetry_plugin/__init__.py
+0
-0
tests/fixtures/git/github.com/demo/poetry-plugin2/subdir/pyproject.toml
+18
-0
tests/fixtures/git/github.com/demo/subdirectories/two/pyproject.toml
+1
-1
No files found.
tests/console/commands/self/test_add_plugins.py
View file @
8ef2a645
...
@@ -138,6 +138,53 @@ Package operations: 3 installs, 0 updates, 0 removals
...
@@ -138,6 +138,53 @@ Package operations: 3 installs, 0 updates, 0 removals
)
)
@pytest.mark.parametrize
(
"url, rev"
,
[
(
"git+https://github.com/demo/poetry-plugin2.git#subdirectory=subdir"
,
None
),
(
"git+https://github.com/demo/poetry-plugin2.git@master#subdirectory=subdir"
,
"master"
,
),
],
)
def
test_add_with_git_constraint_with_subdirectory
(
url
:
str
,
rev
:
str
|
None
,
tester
:
CommandTester
,
repo
:
TestRepository
,
):
repo
.
add_package
(
Package
(
"pendulum"
,
"2.0.5"
))
tester
.
execute
(
url
)
expected
=
"""
Updating dependencies
Resolving dependencies...
Writing lock file
Package operations: 2 installs, 0 updates, 0 removals
• Installing pendulum (2.0.5)
• Installing poetry-plugin (0.1.2 9cf87a2)
"""
constraint
=
{
"git"
:
"https://github.com/demo/poetry-plugin2.git"
,
"subdirectory"
:
"subdir"
,
}
if
rev
:
constraint
[
"rev"
]
=
rev
assert_plugin_add_result
(
tester
,
expected
,
constraint
,
)
def
test_add_existing_plugin_warns_about_no_operation
(
def
test_add_existing_plugin_warns_about_no_operation
(
tester
:
CommandTester
,
tester
:
CommandTester
,
repo
:
TestRepository
,
repo
:
TestRepository
,
...
...
tests/console/commands/test_add.py
View file @
8ef2a645
...
@@ -374,6 +374,53 @@ Package operations: 4 installs, 0 updates, 0 removals
...
@@ -374,6 +374,53 @@ Package operations: 4 installs, 0 updates, 0 removals
}
}
@pytest.mark.parametrize
(
"url, rev"
,
[
(
"git+https://github.com/demo/subdirectories.git#subdirectory=two"
,
None
),
(
"git+https://github.com/demo/subdirectories.git@master#subdirectory=two"
,
"master"
,
),
],
)
def
test_add_git_constraint_with_subdirectory
(
url
:
str
,
rev
:
str
|
None
,
app
:
PoetryTestApplication
,
repo
:
TestRepository
,
tester
:
CommandTester
,
env
:
MockEnv
,
):
tester
.
execute
(
url
)
expected
=
"""
\
Updating dependencies
Resolving dependencies...
Writing lock file
Package operations: 1 install, 0 updates, 0 removals
• Installing two (2.0.0 9cf87a2)
"""
assert
tester
.
io
.
fetch_output
()
.
strip
()
==
expected
.
strip
()
assert
tester
.
command
.
installer
.
executor
.
installations_count
==
1
content
=
app
.
poetry
.
file
.
read
()[
"tool"
][
"poetry"
]
constraint
=
{
"git"
:
"https://github.com/demo/subdirectories.git"
,
"subdirectory"
:
"two"
,
}
if
rev
:
constraint
[
"rev"
]
=
rev
assert
"two"
in
content
[
"dependencies"
]
assert
content
[
"dependencies"
][
"two"
]
==
constraint
@pytest.mark.parametrize
(
"editable"
,
[
False
,
True
])
@pytest.mark.parametrize
(
"editable"
,
[
False
,
True
])
def
test_add_git_ssh_constraint
(
def
test_add_git_ssh_constraint
(
editable
:
bool
,
editable
:
bool
,
...
...
tests/fixtures/git/github.com/demo/poetry-plugin2/subdir/poetry_plugin/__init__.py
0 → 100644
View file @
8ef2a645
tests/fixtures/git/github.com/demo/poetry-plugin2/subdir/pyproject.toml
0 → 100644
View file @
8ef2a645
[tool.poetry]
name
=
"poetry-plugin"
version
=
"0.1.2"
description
=
"Some description."
authors
=
[
"Sébastien Eustace <sebastien@eustace.io>"
]
license
=
"MIT"
[tool.poetry.dependencies]
python
=
"^3.6"
pendulum
=
"^2.0"
tomlkit
=
{version
=
"^0.7.0"
,
optional
=
true
}
[tool.poetry.extras]
foo
=
["tomlkit"]
[tool.poetry.dev-dependencies]
tests/fixtures/git/github.com/demo/subdirectories/two/pyproject.toml
View file @
8ef2a645
...
@@ -6,4 +6,4 @@ authors = []
...
@@ -6,4 +6,4 @@ authors = []
license
=
"MIT"
license
=
"MIT"
[tool.poetry.dependencies]
[tool.poetry.dependencies]
python
=
"
^3.7
"
python
=
"
~2.7 || ^3.4
"
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