Commit 79f26683 by Randy Döring Committed by GitHub

sources: change future warning that PyPI will only be disabled automatically if…

sources: change future warning that PyPI will only be disabled automatically if there are no primary sources (#8151)
parent d508c9f0
...@@ -164,7 +164,7 @@ poetry source add --priority=default foo https://foo.bar/simple/ ...@@ -164,7 +164,7 @@ poetry source add --priority=default foo https://foo.bar/simple/
{{% warning %}} {{% warning %}}
In a future version of Poetry, PyPI will be disabled automatically In a future version of Poetry, PyPI will be disabled automatically
if there is at least one custom source configured with another priority than `explicit`. if at least one custom primary source is configured.
If you are using custom sources in addition to PyPI, you should configure PyPI explicitly If you are using custom sources in addition to PyPI, you should configure PyPI explicitly
with a certain priority, e.g. with a certain priority, e.g.
......
...@@ -181,12 +181,12 @@ class Factory(BaseFactory): ...@@ -181,12 +181,12 @@ class Factory(BaseFactory):
else: else:
from poetry.repositories.pypi_repository import PyPiRepository from poetry.repositories.pypi_repository import PyPiRepository
if pool.repositories: if pool.has_primary_repositories():
io.write_error_line( io.write_error_line(
"<warning>" "<warning>"
"Warning: In a future version of Poetry, PyPI will be disabled" "Warning: In a future version of Poetry, PyPI will be disabled"
" automatically if at least one custom source is configured" " automatically if at least one custom primary source is"
" with another priority than 'explicit'. In order to avoid" " configured. In order to avoid"
" a breaking change and make your pyproject.toml forward" " a breaking change and make your pyproject.toml forward"
" compatible, add PyPI explicitly via 'poetry source add pypi'." " compatible, add PyPI explicitly via 'poetry source add pypi'."
" By the way, this has the advantage that you can set the" " By the way, this has the advantage that you can set the"
......
...@@ -420,7 +420,8 @@ def test_poetry_with_no_default_source(fixture_dir: FixtureDirGetter) -> None: ...@@ -420,7 +420,8 @@ def test_poetry_with_no_default_source(fixture_dir: FixtureDirGetter) -> None:
def test_poetry_with_supplemental_source( def test_poetry_with_supplemental_source(
fixture_dir: FixtureDirGetter, with_simple_keyring: None fixture_dir: FixtureDirGetter, with_simple_keyring: None
) -> None: ) -> None:
poetry = Factory().create_poetry(fixture_dir("with_supplemental_source")) io = BufferedIO()
poetry = Factory().create_poetry(fixture_dir("with_supplemental_source"), io=io)
assert poetry.pool.has_repository("PyPI") assert poetry.pool.has_repository("PyPI")
assert poetry.pool.get_priority("PyPI") is Priority.DEFAULT assert poetry.pool.get_priority("PyPI") is Priority.DEFAULT
...@@ -429,12 +430,14 @@ def test_poetry_with_supplemental_source( ...@@ -429,12 +430,14 @@ def test_poetry_with_supplemental_source(
assert poetry.pool.get_priority("supplemental") is Priority.SUPPLEMENTAL assert poetry.pool.get_priority("supplemental") is Priority.SUPPLEMENTAL
assert isinstance(poetry.pool.repository("supplemental"), LegacyRepository) assert isinstance(poetry.pool.repository("supplemental"), LegacyRepository)
assert {repo.name for repo in poetry.pool.repositories} == {"PyPI", "supplemental"} assert {repo.name for repo in poetry.pool.repositories} == {"PyPI", "supplemental"}
assert io.fetch_error() == ""
def test_poetry_with_explicit_source( def test_poetry_with_explicit_source(
fixture_dir: FixtureDirGetter, with_simple_keyring: None fixture_dir: FixtureDirGetter, with_simple_keyring: None
) -> None: ) -> None:
poetry = Factory().create_poetry(fixture_dir("with_explicit_source")) io = BufferedIO()
poetry = Factory().create_poetry(fixture_dir("with_explicit_source"), io=io)
assert len(poetry.pool.repositories) == 1 assert len(poetry.pool.repositories) == 1
assert len(poetry.pool.all_repositories) == 2 assert len(poetry.pool.all_repositories) == 2
...@@ -444,6 +447,7 @@ def test_poetry_with_explicit_source( ...@@ -444,6 +447,7 @@ def test_poetry_with_explicit_source(
assert poetry.pool.has_repository("explicit") assert poetry.pool.has_repository("explicit")
assert isinstance(poetry.pool.repository("explicit"), LegacyRepository) assert isinstance(poetry.pool.repository("explicit"), LegacyRepository)
assert {repo.name for repo in poetry.pool.repositories} == {"PyPI"} assert {repo.name for repo in poetry.pool.repositories} == {"PyPI"}
assert io.fetch_error() == ""
def test_poetry_with_explicit_pypi_and_other( def test_poetry_with_explicit_pypi_and_other(
......
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