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
e200a288
Commit
e200a288
authored
Oct 02, 2020
by
Arun Babu Neelicattu
Committed by
finswimmer
Oct 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
publish: ensure config url is preferred
parent
733310ca
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
poetry/factory.py
+2
-0
tests/publishing/test_publisher.py
+16
-8
No files found.
poetry/factory.py
View file @
e200a288
...
@@ -51,10 +51,12 @@ class Factory(BaseFactory):
...
@@ -51,10 +51,12 @@ class Factory(BaseFactory):
# Load local sources
# Load local sources
repositories
=
{}
repositories
=
{}
existing_repositories
=
config
.
get
(
"repositories"
,
{})
for
source
in
base_poetry
.
pyproject
.
poetry_config
.
get
(
"source"
,
[]):
for
source
in
base_poetry
.
pyproject
.
poetry_config
.
get
(
"source"
,
[]):
name
=
source
.
get
(
"name"
)
name
=
source
.
get
(
"name"
)
url
=
source
.
get
(
"url"
)
url
=
source
.
get
(
"url"
)
if
name
and
url
:
if
name
and
url
:
if
name
not
in
existing_repositories
:
repositories
[
name
]
=
{
"url"
:
url
}
repositories
[
name
]
=
{
"url"
:
url
}
config
.
merge
({
"repositories"
:
repositories
})
config
.
merge
({
"repositories"
:
repositories
})
...
...
tests/publishing/test_publisher.py
View file @
e200a288
...
@@ -29,28 +29,36 @@ def test_publish_publishes_to_pypi_by_default(fixture_dir, mocker, config):
...
@@ -29,28 +29,36 @@ def test_publish_publishes_to_pypi_by_default(fixture_dir, mocker, config):
]
==
uploader_upload
.
call_args
]
==
uploader_upload
.
call_args
def
test_publish_can_publish_to_given_repository
(
fixture_dir
,
mocker
,
config
):
@pytest.mark.parametrize
(
(
"fixture_name"
,),
[(
"sample_project"
,),
(
"with_default_source"
,)]
)
def
test_publish_can_publish_to_given_repository
(
fixture_dir
,
mocker
,
config
,
fixture_name
):
uploader_auth
=
mocker
.
patch
(
"poetry.publishing.uploader.Uploader.auth"
)
uploader_auth
=
mocker
.
patch
(
"poetry.publishing.uploader.Uploader.auth"
)
uploader_upload
=
mocker
.
patch
(
"poetry.publishing.uploader.Uploader.upload"
)
uploader_upload
=
mocker
.
patch
(
"poetry.publishing.uploader.Uploader.upload"
)
poetry
=
Factory
()
.
create_poetry
(
fixture_dir
(
"sample_project"
))
poetry
.
_config
=
config
config
.
merge
(
poetry
.
config
.
merge
(
{
{
"repositories"
:
{
"
my-rep
o"
:
{
"url"
:
"http://foo.bar"
}},
"repositories"
:
{
"
fo
o"
:
{
"url"
:
"http://foo.bar"
}},
"http-basic"
:
{
"
my-rep
o"
:
{
"username"
:
"foo"
,
"password"
:
"bar"
}},
"http-basic"
:
{
"
fo
o"
:
{
"username"
:
"foo"
,
"password"
:
"bar"
}},
}
}
)
)
mocker
.
patch
(
"poetry.factory.Factory.create_config"
,
return_value
=
config
)
poetry
=
Factory
()
.
create_poetry
(
fixture_dir
(
fixture_name
))
io
=
BufferedIO
()
io
=
BufferedIO
()
publisher
=
Publisher
(
poetry
,
io
)
publisher
=
Publisher
(
poetry
,
io
)
publisher
.
publish
(
"
my-rep
o"
,
None
,
None
)
publisher
.
publish
(
"
fo
o"
,
None
,
None
)
assert
[(
"foo"
,
"bar"
)]
==
uploader_auth
.
call_args
assert
[(
"foo"
,
"bar"
)]
==
uploader_auth
.
call_args
assert
[
assert
[
(
"http://foo.bar"
,),
(
"http://foo.bar"
,),
{
"cert"
:
None
,
"client_cert"
:
None
,
"dry_run"
:
False
},
{
"cert"
:
None
,
"client_cert"
:
None
,
"dry_run"
:
False
},
]
==
uploader_upload
.
call_args
]
==
uploader_upload
.
call_args
assert
"Publishing my-package (1.2.3) to
my-rep
o"
in
io
.
fetch_output
()
assert
"Publishing my-package (1.2.3) to
fo
o"
in
io
.
fetch_output
()
def
test_publish_raises_error_for_undefined_repository
(
fixture_dir
,
mocker
,
config
):
def
test_publish_raises_error_for_undefined_repository
(
fixture_dir
,
mocker
,
config
):
...
...
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