diff --git a/docs/cli.md b/docs/cli.md
index 085f1fe86a9..208f2b551d4 100644
--- a/docs/cli.md
+++ b/docs/cli.md
@@ -321,8 +321,9 @@ poetry add requests pendulum
```
{{% note %}}
-A package is looked up, by default, only from the [Default Package Source]({{< relref "repositories/#default-package-source" >}}).
-You can modify the default source (PyPI); or add and use [Supplemental Package Sources]({{< relref "repositories/#supplemental-package-sources" >}})
+A package is looked up, by default, only from [PyPI](https://pypi.org).
+You can modify the default source (PyPI);
+or add and use [Supplemental Package Sources]({{< relref "repositories/#supplemental-package-sources" >}})
or [Explicit Package Sources]({{< relref "repositories/#explicit-package-sources" >}}).
For more information, refer to the [Package Sources]({{< relref "repositories/#package-sources" >}}) documentation.
@@ -865,13 +866,7 @@ poetry source add --priority=explicit pypi
#### Options
-* `--default`: Set this source as the [default]({{< relref "repositories#default-package-source" >}}) (disable PyPI). Deprecated in favor of `--priority`.
-* `--secondary`: Set this source as a [secondary]({{< relref "repositories#secondary-package-sources" >}}) source. Deprecated in favor of `--priority`.
-* `--priority`: Set the priority of this source. Accepted values are: [`default`]({{< relref "repositories#default-package-source" >}}), [`secondary`]({{< relref "repositories#secondary-package-sources" >}}), [`supplemental`]({{< relref "repositories#supplemental-package-sources" >}}), and [`explicit`]({{< relref "repositories#explicit-package-sources" >}}). Refer to the dedicated sections in [Repositories]({{< relref "repositories" >}}) for more information.
-
-{{% note %}}
-At most one of the options above can be provided. See [package sources]({{< relref "repositories#package-sources" >}}) for more information.
-{{% /note %}}
+* `--priority`: Set the priority of this source. Accepted values are: [`supplemental`]({{< relref "repositories#supplemental-package-sources" >}}), and [`explicit`]({{< relref "repositories#explicit-package-sources" >}}). Refer to the dedicated sections in [Repositories]({{< relref "repositories" >}}) for more information.
### source show
diff --git a/docs/repositories.md b/docs/repositories.md
index 983628dd670..31122036dfe 100644
--- a/docs/repositories.md
+++ b/docs/repositories.md
@@ -104,12 +104,15 @@ poetry publish --build --repository foo-pub
## Package Sources
-By default, Poetry is configured to use the Python ecosystem's canonical package index
+By default, if you have not configured any primary source,
+Poetry is configured to use the Python ecosystem's canonical package index
[PyPI](https://pypi.org).
+You can alter this behaviour and exclusively look up packages only from the configured
+package sources by adding at least one primary source.
{{% note %}}
-With the exception of the implicitly configured source for [PyPI](https://pypi.org) named `pypi`,
+Except for the implicitly configured source for [PyPI](https://pypi.org) named `PyPI`,
package sources are local to a project and must be configured within the project's
[`pyproject.toml`]({{< relref "pyproject" >}}) file. This is **not** the same configuration used
when publishing a package.
@@ -142,56 +145,17 @@ url = "https://foo.bar/simple/"
priority = "primary"
```
-If `priority` is undefined, the source is considered a primary source that takes precedence over PyPI, secondary, supplemental and explicit sources.
+If `priority` is undefined, the source is considered a primary source,
+which disables the implicit PyPI source and takes precedence over supplemental sources.
Package sources are considered in the following order:
-1. [default source](#default-package-source-deprecated) (DEPRECATED),
-2. [primary sources](#primary-package-sources),
-3. implicit PyPI (unless disabled by another [primary source](#primary-package-sources), [default source](#default-package-source-deprecated) or configured explicitly),
-4. [secondary sources](#secondary-package-sources-deprecated) (DEPRECATED),
-5. [supplemental sources](#supplemental-package-sources).
+1. [primary sources](#primary-package-sources) or implicit PyPI (if there are no primary sources),
+2. [supplemental sources](#supplemental-package-sources).
[Explicit sources](#explicit-package-sources) are considered only for packages that explicitly [indicate their source](#package-source-constraint).
Within each priority class, package sources are considered in order of appearance in `pyproject.toml`.
-{{% note %}}
-
-If you want to change the priority of [PyPI](https://pypi.org), you can set it explicitly, e.g.
-
-```bash
-poetry source add --priority=primary PyPI
-```
-
-If you prefer to disable PyPI completely,
-just add a [primary source](#primary-package-sources)
-or configure PyPI as [explicit source](#explicit-package-sources).
-
-{{% /note %}}
-
-
-#### Default Package Source (DEPRECATED)
-
-*Deprecated in 1.8.0*
-
-{{% warning %}}
-
-Configuring a default package source is deprecated because it is the same
-as the topmost [primary source](#primary-package-sources).
-Just configure a primary package source and put it first in the list of package sources.
-
-{{% /warning %}}
-
-By default, if you have not configured any primary source,
-Poetry will configure [PyPI](https://pypi.org) as the package source for your project.
-You can alter this behaviour and exclusively look up packages only from the configured
-package sources by adding at least one primary source (recommended)
-or a **single** source with `priority = "default"` (deprecated).
-
-```bash
-poetry source add --priority=default foo https://foo.bar/simple/
-```
-
#### Primary Package Sources
@@ -234,27 +198,6 @@ with Poetry, the PyPI repository cannot be configured with a given URL. Remember
{{% /warning %}}
-#### Secondary Package Sources (DEPRECATED)
-
-*Deprecated in 1.5.0*
-
-If package sources are configured as secondary, all it means is that these will be given a lower
-priority when selecting compatible package distribution that also exists in your default and primary package sources. If the package source should instead be searched only if higher-priority repositories did not return results, please consider a [supplemental source](#supplemental-package-sources) instead.
-
-You can configure a package source as a secondary source with `priority = "secondary"` in your package
-source configuration.
-
-```bash
-poetry source add --priority=secondary foo https://foo.bar/simple/
-```
-
-There can be more than one secondary package source.
-
-{{% warning %}}
-
-Secondary package sources are deprecated in favor of supplemental package sources.
-
-{{% /warning %}}
#### Supplemental Package Sources
@@ -305,9 +248,10 @@ poetry add --source pytorch-gpu-src torch torchvision torchaudio
#### Package Source Constraint
-All package sources (including secondary and possibly supplemental sources) will be searched during the package lookup
-process. These network requests will occur for all sources, regardless of if the package is
-found at one or more sources.
+All package sources (including possibly supplemental sources) will be searched
+during the package lookup process.
+These network requests will occur for all primary sources, regardless of if the package is
+found at one or more sources, and all supplemental sources until the package is found.
In order to limit the search for a specific package to a particular package repository, you can specify the source explicitly.
@@ -398,8 +342,8 @@ httpx = {version = "^0.22.0", source = "pypi"}
{{% warning %}}
-If any source within a project is configured with `priority = "default"`, The implicit `pypi` source will
-be disabled and not used for any packages.
+The implicit `PyPI` source will be disabled and not used for any packages
+if at least one [primary source](#primary-package-sources) is configured.
{{% /warning %}}
diff --git a/src/poetry/config/source.py b/src/poetry/config/source.py
index f2ff82c2ece..aa7d9a25743 100644
--- a/src/poetry/config/source.py
+++ b/src/poetry/config/source.py
@@ -1,7 +1,6 @@
from __future__ import annotations
import dataclasses
-import warnings
from typing import TYPE_CHECKING
@@ -16,27 +15,13 @@
class Source:
name: str
url: str = ""
- default: dataclasses.InitVar[bool] = False
- secondary: dataclasses.InitVar[bool] = False
priority: Priority = (
Priority.PRIMARY
) # cheating in annotation: str will be converted to Priority in __post_init__
- def __post_init__(self, default: bool, secondary: bool) -> None:
+ def __post_init__(self) -> None:
if isinstance(self.priority, str):
self.priority = Priority[self.priority.upper()]
- if default or secondary:
- warnings.warn(
- "Parameters 'default' and 'secondary' to"
- " 'Source' are deprecated. Please provide"
- " 'priority' instead.",
- DeprecationWarning,
- stacklevel=2,
- )
- if default:
- self.priority = Priority.DEFAULT
- elif secondary:
- self.priority = Priority.SECONDARY
def to_dict(self) -> dict[str, str | bool]:
return dataclasses.asdict(
diff --git a/src/poetry/console/commands/source/add.py b/src/poetry/console/commands/source/add.py
index 669ac2f3c01..541593cac1a 100644
--- a/src/poetry/console/commands/source/add.py
+++ b/src/poetry/console/commands/source/add.py
@@ -36,19 +36,6 @@ class SourceAddCommand(Command):
]
options: ClassVar[list[Option]] = [
- option(
- "default",
- "d",
- "Set this source as the default (disable PyPI). A "
- "default source will also be the fallback source if "
- "you add other sources. (Deprecated, use --priority)",
- ),
- option(
- "secondary",
- "s",
- "Set this source as secondary. (Deprecated, use"
- " --priority)",
- ),
option(
"priority",
"p",
@@ -65,8 +52,6 @@ def handle(self) -> int:
name: str = self.argument("name")
lower_name = name.lower()
url: str = self.argument("url")
- is_default: bool = self.option("default", False)
- is_secondary: bool = self.option("secondary", False)
priority_str: str | None = self.option("priority", None)
if lower_name == "pypi":
@@ -82,66 +67,16 @@ def handle(self) -> int:
)
return 1
- if is_default and is_secondary:
- self.line_error(
- "Cannot configure a source as both default and"
- " secondary."
- )
- return 1
-
- if is_default or is_secondary:
- if priority_str is not None:
- self.line_error(
- "Priority was passed through both --priority and a"
- " deprecated flag (--default or --secondary). Please only provide"
- " one of these."
- )
- return 1
- else:
- self.line_error(
- "Warning: Priority was set through a deprecated flag"
- " (--default or --secondary). Consider using --priority next"
- " time."
- )
-
- if is_default:
- priority = Priority.DEFAULT
- elif is_secondary:
- priority = Priority.SECONDARY
- elif priority_str is None:
+ if priority_str is None:
priority = Priority.PRIMARY
else:
priority = Priority[priority_str.upper()]
- if priority is Priority.SECONDARY:
- allowed_prios = (
- p for p in Priority if p not in {Priority.DEFAULT, Priority.SECONDARY}
- )
- self.line_error(
- "Warning: Priority 'secondary' is deprecated. Consider"
- " changing the priority to one of the non-deprecated values:"
- f" {', '.join(repr(p.name.lower()) for p in allowed_prios)}."
- )
- if priority is Priority.DEFAULT:
- self.line_error(
- "Warning: Priority 'default' is deprecated. You can achieve"
- " the same effect by changing the priority to 'primary' and putting"
- " the source first."
- )
-
sources = AoT([])
new_source = Source(name=name, url=url, priority=priority)
is_new_source = True
for source in self.poetry.get_sources():
- if source.priority is Priority.DEFAULT and priority is Priority.DEFAULT:
- self.line_error(
- f"Source with name {source.name} is already set to"
- " default. Only one default source can be configured at a"
- " time."
- )
- return 1
-
if source.name.lower() == lower_name:
source = new_source
is_new_source = False
diff --git a/src/poetry/factory.py b/src/poetry/factory.py
index f016dcf88e6..052e9cd8105 100644
--- a/src/poetry/factory.py
+++ b/src/poetry/factory.py
@@ -130,46 +130,12 @@ def create_pool(
source, config, disable_cache=disable_cache
)
priority = Priority[source.get("priority", Priority.PRIMARY.name).upper()]
- if "default" in source or "secondary" in source:
- warning = (
- "Found deprecated key 'default' or 'secondary' in"
- " pyproject.toml configuration for source"
- f" {source.get('name')}. Please provide the key 'priority'"
- " instead. Accepted values are:"
- f" {', '.join(repr(p.name.lower()) for p in Priority)}."
- )
- io.write_error_line(f"Warning: {warning}")
- if source.get("default"):
- priority = Priority.DEFAULT
- elif source.get("secondary"):
- priority = Priority.SECONDARY
-
- if priority is Priority.SECONDARY:
- allowed_prios = (p for p in Priority if p is not Priority.SECONDARY)
- warning = (
- "Found deprecated priority 'secondary' for source"
- f" '{source.get('name')}' in pyproject.toml. Consider changing the"
- " priority to one of the non-deprecated values:"
- f" {', '.join(repr(p.name.lower()) for p in allowed_prios)}."
- )
- io.write_error_line(f"Warning: {warning}")
- elif priority is Priority.DEFAULT:
- warning = (
- "Found deprecated priority 'default' for source"
- f" '{source.get('name')}' in pyproject.toml. You can achieve"
- " the same effect by changing the priority to 'primary' and putting"
- " the source first."
- )
- io.write_error_line(f"Warning: {warning}")
if io.is_debug():
- message = f"Adding repository {repository.name} ({repository.url})"
- if priority is Priority.DEFAULT:
- message += " and setting it as the default one"
- else:
- message += f" and setting it as {priority.name.lower()}"
-
- io.write_line(message)
+ io.write_line(
+ f"Adding repository {repository.name} ({repository.url})"
+ f" and setting it as {priority.name.lower()}"
+ )
pool.add_repository(repository, priority=priority)
if repository.name.lower() == "pypi":
@@ -177,7 +143,7 @@ def create_pool(
# Only add PyPI if no default repository is configured
if not explicit_pypi:
- if pool.has_default() or pool.has_primary_repositories():
+ if pool.has_primary_repositories():
if io.is_debug():
io.write_line("Deactivating the PyPI repository")
else:
diff --git a/src/poetry/json/schemas/poetry.json b/src/poetry/json/schemas/poetry.json
index 93a822d28b9..279f3290f4b 100644
--- a/src/poetry/json/schemas/poetry.json
+++ b/src/poetry/json/schemas/poetry.json
@@ -32,19 +32,9 @@
"description": "The url of the repository.",
"format": "uri"
},
- "default": {
- "type": "boolean",
- "description": "Make this repository the default (disable PyPI). (deprecated, see priority)"
- },
- "secondary": {
- "type": "boolean",
- "description": "Declare this repository as secondary, i.e. default repositories take precedence. (deprecated, see priority)"
- },
"priority": {
"enum": [
"primary",
- "default",
- "secondary",
"supplemental",
"explicit"
],
@@ -58,22 +48,6 @@
"type": "boolean",
"description": "For PEP 503 simple API repositories, pre-fetch and index the available packages. (experimental)"
}
- },
- "not": {
- "anyOf": [
- {
- "required": [
- "priority",
- "default"
- ]
- },
- {
- "required": [
- "priority",
- "secondary"
- ]
- }
- ]
}
}
}
diff --git a/src/poetry/repositories/repository_pool.py b/src/poetry/repositories/repository_pool.py
index 9d6338f4ff2..6a68b503fe3 100644
--- a/src/poetry/repositories/repository_pool.py
+++ b/src/poetry/repositories/repository_pool.py
@@ -26,9 +26,7 @@
class Priority(IntEnum):
# The order of the members below dictates the actual priority. The first member has
# top priority.
- DEFAULT = enum.auto()
PRIMARY = enum.auto()
- SECONDARY = enum.auto()
SUPPLEMENTAL = enum.auto()
EXPLICIT = enum.auto()
@@ -118,9 +116,6 @@ def _sorted_repositories(self) -> list[PrioritizedRepository]:
def artifact_cache(self) -> ArtifactCache:
return self._artifact_cache
- def has_default(self) -> bool:
- return self._contains_priority(Priority.DEFAULT)
-
def has_primary_repositories(self) -> bool:
return self._contains_priority(Priority.PRIMARY)
@@ -145,12 +140,7 @@ def _get_prioritized_repository(self, name: str) -> PrioritizedRepository:
raise IndexError(f'Repository "{name}" does not exist.')
def add_repository(
- self,
- repository: Repository,
- default: bool = False,
- secondary: bool = False,
- *,
- priority: Priority = Priority.PRIMARY,
+ self, repository: Repository, *, priority: Priority = Priority.PRIMARY
) -> RepositoryPool:
"""
Adds a repository to the pool.
@@ -161,19 +151,6 @@ def add_repository(
f"A repository with name {repository_name} was already added."
)
- if default or secondary:
- warnings.warn(
- "Parameters 'default' and 'secondary' to"
- " 'RepositoryPool.add_repository' are deprecated. Please provide"
- " the keyword-argument 'priority' instead.",
- DeprecationWarning,
- stacklevel=2,
- )
- priority = Priority.DEFAULT if default else Priority.SECONDARY
-
- if priority is Priority.DEFAULT and self.has_default():
- raise ValueError("Only one repository can be the default.")
-
self._repositories[repository_name] = PrioritizedRepository(
repository, priority
)
diff --git a/tests/config/test_source.py b/tests/config/test_source.py
index 2331dcb4339..e639b81c91f 100644
--- a/tests/config/test_source.py
+++ b/tests/config/test_source.py
@@ -43,29 +43,11 @@ def test_source_default_is_primary() -> None:
assert source.priority == Priority.PRIMARY
-@pytest.mark.parametrize(
- ("default", "secondary", "expected_priority"),
- [
- (False, True, Priority.SECONDARY),
- (True, False, Priority.DEFAULT),
- (True, True, Priority.DEFAULT),
- ],
-)
-def test_source_legacy_handling(
- default: bool, secondary: bool, expected_priority: Priority
-) -> None:
- with pytest.warns(DeprecationWarning):
- source = Source(
- "foo", "https://example.com", default=default, secondary=secondary
- )
- assert source.priority == expected_priority
-
-
@pytest.mark.parametrize(
("priority", "expected_priority"),
[
- ("secondary", Priority.SECONDARY),
- ("SECONDARY", Priority.SECONDARY),
+ ("supplemental", Priority.SUPPLEMENTAL),
+ ("SUPPLEMENTAL", Priority.SUPPLEMENTAL),
],
)
def test_source_priority_as_string(priority: str, expected_priority: Priority) -> None:
@@ -74,4 +56,4 @@ def test_source_priority_as_string(priority: str, expected_priority: Priority) -
"https://example.com",
priority=priority, # type: ignore[arg-type]
)
- assert source.priority == Priority.SECONDARY
+ assert source.priority == Priority.SUPPLEMENTAL
diff --git a/tests/console/commands/source/conftest.py b/tests/console/commands/source/conftest.py
index 7e44e280069..264ee640e6f 100644
--- a/tests/console/commands/source/conftest.py
+++ b/tests/console/commands/source/conftest.py
@@ -24,33 +24,11 @@ def source_two() -> Source:
return Source(name="two", url="https://two.com")
-@pytest.fixture
-def source_default_deprecated() -> Source:
- return Source(name="default", url="https://default.com", default=True)
-
-
-@pytest.fixture
-def source_secondary_deprecated() -> Source:
- return Source(name="secondary", url="https://secondary.com", secondary=True)
-
-
@pytest.fixture
def source_primary() -> Source:
return Source(name="primary", url="https://primary.com", priority=Priority.PRIMARY)
-@pytest.fixture
-def source_default() -> Source:
- return Source(name="default", url="https://default.com", priority=Priority.DEFAULT)
-
-
-@pytest.fixture
-def source_secondary() -> Source:
- return Source(
- name="secondary", url="https://secondary.com", priority=Priority.SECONDARY
- )
-
-
@pytest.fixture
def source_supplemental() -> Source:
return Source(
@@ -158,16 +136,12 @@ def add_all_source_types(
command_tester_factory: CommandTesterFactory,
poetry_with_source: Poetry,
source_primary: Source,
- source_default: Source,
- source_secondary: Source,
source_supplemental: Source,
source_explicit: Source,
) -> None:
add = command_tester_factory("source add", poetry=poetry_with_source)
for source in [
source_primary,
- source_default,
- source_secondary,
source_supplemental,
source_explicit,
]:
diff --git a/tests/console/commands/source/test_add.py b/tests/console/commands/source/test_add.py
index 53ae876133a..91a2a8cb127 100644
--- a/tests/console/commands/source/test_add.py
+++ b/tests/console/commands/source/test_add.py
@@ -22,51 +22,13 @@ def tester(
return command_tester_factory("source add", poetry=poetry_with_source)
-def _get_source_warning(priority: Priority) -> str:
- if priority is Priority.SECONDARY:
- return (
- "Warning: Priority 'secondary' is deprecated. Consider changing the"
- " priority to one of the non-deprecated values: 'primary',"
- " 'supplemental', 'explicit'."
- )
- elif priority is Priority.DEFAULT:
- return (
- "Warning: Priority 'default' is deprecated. You can achieve"
- " the same effect by changing the priority to 'primary' and putting"
- " the source first."
- )
- return ""
-
-
-def assert_source_added_legacy(
- tester: CommandTester,
- poetry: Poetry,
- source_existing: Source,
- source_added: Source,
-) -> None:
- warning = (
- "Warning: Priority was set through a deprecated flag (--default or"
- " --secondary). Consider using --priority next time.\n"
- + _get_source_warning(source_added.priority)
- )
- assert tester.io.fetch_error().strip() == warning
- assert (
- tester.io.fetch_output().strip()
- == f"Adding source with name {source_added.name}."
- )
- poetry.pyproject.reload()
- sources = poetry.get_sources()
- assert sources == [source_existing, source_added]
- assert tester.status_code == 0
-
-
def assert_source_added(
tester: CommandTester,
poetry: Poetry,
source_existing: Source,
source_added: Source,
) -> None:
- assert tester.io.fetch_error().strip() == _get_source_warning(source_added.priority)
+ assert tester.io.fetch_error().strip() == ""
assert (
tester.io.fetch_output().strip()
== f"Adding source with name {source_added.name}."
@@ -87,72 +49,6 @@ def test_source_add_simple(
assert_source_added(tester, poetry_with_source, source_existing, source_one)
-def test_source_add_default_legacy(
- tester: CommandTester,
- source_existing: Source,
- source_default: Source,
- poetry_with_source: Poetry,
-) -> None:
- tester.execute(f"--default {source_default.name} {source_default.url}")
- assert_source_added_legacy(
- tester, poetry_with_source, source_existing, source_default
- )
-
-
-def test_source_add_secondary_legacy(
- tester: CommandTester,
- source_existing: Source,
- source_secondary: Source,
- poetry_with_source: Poetry,
-) -> None:
- tester.execute(f"--secondary {source_secondary.name} {source_secondary.url}")
- assert_source_added_legacy(
- tester, poetry_with_source, source_existing, source_secondary
- )
-
-
-def test_source_add_default(
- tester: CommandTester,
- source_existing: Source,
- source_default: Source,
- poetry_with_source: Poetry,
-) -> None:
- tester.execute(f"--priority=default {source_default.name} {source_default.url}")
- assert_source_added(tester, poetry_with_source, source_existing, source_default)
-
-
-def test_source_add_second_default_fails(
- tester: CommandTester,
- source_existing: Source,
- source_default: Source,
- poetry_with_source: Poetry,
-) -> None:
- tester.execute(f"--priority=default {source_default.name} {source_default.url}")
- assert_source_added(tester, poetry_with_source, source_existing, source_default)
- poetry_with_source.pyproject.reload()
-
- tester.execute(f"--priority=default {source_default.name}1 {source_default.url}")
- assert (
- tester.io.fetch_error().strip()
- == f"{_get_source_warning(source_default.priority)}\n"
- f"Source with name {source_default.name} is already set to default."
- " Only one default source can be configured at a time."
- )
- assert tester.status_code == 1
-
-
-def test_source_add_secondary(
- tester: CommandTester,
- source_existing: Source,
- source_secondary: Source,
- poetry_with_source: Poetry,
-) -> None:
- tester.execute(
- f"--priority=secondary {source_secondary.name} {source_secondary.url}"
- )
- assert_source_added(tester, poetry_with_source, source_existing, source_secondary)
-
-
def test_source_add_supplemental(
tester: CommandTester,
source_existing: Source,
@@ -177,26 +73,6 @@ def test_source_add_explicit(
assert_source_added(tester, poetry_with_source, source_existing, source_explicit)
-def test_source_add_error_default_and_secondary_legacy(tester: CommandTester) -> None:
- tester.execute("--default --secondary error https://error.com")
- assert (
- tester.io.fetch_error().strip()
- == "Cannot configure a source as both default and secondary."
- )
- assert tester.status_code == 1
-
-
-def test_source_add_error_priority_and_deprecated_legacy(tester: CommandTester) -> None:
- tester.execute("--priority secondary --secondary error https://error.com")
- assert (
- tester.io.fetch_error().strip()
- == "Priority was passed through both --priority and a"
- " deprecated flag (--default or --secondary). Please only provide"
- " one of these."
- )
- assert tester.status_code == 1
-
-
def test_source_add_error_no_url(tester: CommandTester) -> None:
tester.execute("foo")
assert (
@@ -238,32 +114,6 @@ def test_source_add_pypi_explicit(
)
-def test_source_add_existing_legacy(
- tester: CommandTester, source_existing: Source, poetry_with_source: Poetry
-) -> None:
- tester.execute(f"--default {source_existing.name} {source_existing.url}")
- assert (
- tester.io.fetch_error().strip()
- == "Warning: Priority was set through a deprecated flag"
- " (--default or --secondary). Consider using --priority next"
- f" time.\n{_get_source_warning(Priority.DEFAULT)}"
- )
- assert (
- tester.io.fetch_output().strip()
- == f"Source with name {source_existing.name} already exists. Updating."
- )
-
- poetry_with_source.pyproject.reload()
- sources = poetry_with_source.get_sources()
-
- assert len(sources) == 1
- assert sources[0] != source_existing
- expected_source = Source(
- name=source_existing.name, url=source_existing.url, priority=Priority.DEFAULT
- )
- assert sources[0] == expected_source
-
-
@pytest.mark.parametrize("modifier", ["lower", "upper"])
def test_source_add_existing_no_change_except_case_of_name(
modifier: str,
@@ -295,7 +145,7 @@ def test_source_add_existing_updating(
poetry_with_source: Poetry,
) -> None:
name = getattr(source_existing.name, modifier)()
- tester.execute(f"--priority=default {name} {source_existing.url}")
+ tester.execute(f"--priority=supplemental {name} {source_existing.url}")
assert (
tester.io.fetch_output().strip()
== f"Source with name {name} already exists. Updating."
@@ -307,31 +157,6 @@ def test_source_add_existing_updating(
assert len(sources) == 1
assert sources[0] != source_existing
expected_source = Source(
- name=name, url=source_existing.url, priority=Priority.DEFAULT
+ name=name, url=source_existing.url, priority=Priority.SUPPLEMENTAL
)
assert sources[0] == expected_source
-
-
-@pytest.mark.parametrize("modifier", ["lower", "upper"])
-def test_source_add_existing_fails_due_to_other_default(
- modifier: str,
- tester: CommandTester,
- source_existing: Source,
- source_default: Source,
- poetry_with_source: Poetry,
-) -> None:
- tester.execute(f"--priority=default {source_default.name} {source_default.url}")
- tester.io.fetch_error()
- tester.io.fetch_output()
-
- name = getattr(source_existing.name, modifier)()
- tester.execute(f"--priority=default {name} {source_existing.url}")
-
- assert (
- tester.io.fetch_error().strip()
- == f"{_get_source_warning(source_default.priority)}\n"
- f"Source with name {source_default.name} is already set to default."
- " Only one default source can be configured at a time."
- )
- assert tester.io.fetch_output().strip() == ""
- assert tester.status_code == 1
diff --git a/tests/console/commands/source/test_show.py b/tests/console/commands/source/test_show.py
index 91993a62557..bee08603d5c 100644
--- a/tests/console/commands/source/test_show.py
+++ b/tests/console/commands/source/test_show.py
@@ -119,8 +119,6 @@ def test_source_show_two(
"source_str",
(
"source_primary",
- "source_default",
- "source_secondary",
"source_supplemental",
"source_explicit",
),
diff --git a/tests/console/commands/test_config.py b/tests/console/commands/test_config.py
index 737ec373474..e064b5392fe 100644
--- a/tests/console/commands/test_config.py
+++ b/tests/console/commands/test_config.py
@@ -328,7 +328,7 @@ def test_list_must_not_display_sources_from_pyproject_toml(
command_tester_factory: CommandTesterFactory,
config_cache_dir: Path,
) -> None:
- source = fixture_dir("with_non_default_source_implicit")
+ source = fixture_dir("with_primary_source_implicit")
pyproject_content = (source / "pyproject.toml").read_text(encoding="utf-8")
poetry = project_factory("foo", pyproject_content=pyproject_content)
tester = command_tester_factory("config", poetry=poetry)
diff --git a/tests/fixtures/with_default_source_and_pypi/README.rst b/tests/fixtures/with_default_source_and_pypi/README.rst
deleted file mode 100644
index f7fe15470f9..00000000000
--- a/tests/fixtures/with_default_source_and_pypi/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-My Package
-==========
diff --git a/tests/fixtures/with_default_source_and_pypi/pyproject.toml b/tests/fixtures/with_default_source_and_pypi/pyproject.toml
deleted file mode 100644
index cf7ec689a8f..00000000000
--- a/tests/fixtures/with_default_source_and_pypi/pyproject.toml
+++ /dev/null
@@ -1,65 +0,0 @@
-[tool.poetry]
-name = "with-default-source-and-pypi"
-version = "1.2.3"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-license = "MIT"
-
-readme = "README.rst"
-
-homepage = "https://python-poetry.org"
-repository = "https://github.com/python-poetry/poetry"
-documentation = "https://python-poetry.org/docs"
-
-keywords = ["packaging", "dependency", "poetry"]
-
-classifiers = [
- "Topic :: Software Development :: Build Tools",
- "Topic :: Software Development :: Libraries :: Python Modules"
-]
-
-# Requirements
-[tool.poetry.dependencies]
-python = "^3.6"
-cleo = "^0.6"
-pendulum = { git = "https://github.com/sdispater/pendulum.git", branch = "2.0" }
-requests = { version = "^2.18", optional = true, extras=[ "security" ] }
-pathlib2 = { version = "^2.2", python = "~3.6" }
-
-orator = { version = "^0.9", optional = true }
-
-# File dependency
-demo = { path = "../distributions/demo-0.1.0-py2.py3-none-any.whl" }
-
-# Dir dependency with setup.py
-my-package = { path = "../project_with_setup/" }
-
-# Dir dependency with pyproject.toml
-simple-project = { path = "../simple_project/" }
-
-
-[tool.poetry.extras]
-db = [ "orator" ]
-
-[tool.poetry.group.dev.dependencies]
-pytest = "~3.4"
-
-
-[tool.poetry.scripts]
-my-script = "my_package:main"
-
-
-[tool.poetry.plugins."blogtool.parsers"]
-".rst" = "some_module::SomeClass"
-
-
-[[tool.poetry.source]]
-name = "foo"
-url = "https://foo.bar/simple/"
-priority = "default"
-
-
-[[tool.poetry.source]]
-name = "PyPI"
diff --git a/tests/fixtures/with_default_source_legacy/README.rst b/tests/fixtures/with_default_source_legacy/README.rst
deleted file mode 100644
index f7fe15470f9..00000000000
--- a/tests/fixtures/with_default_source_legacy/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-My Package
-==========
diff --git a/tests/fixtures/with_default_source_legacy/pyproject.toml b/tests/fixtures/with_default_source_legacy/pyproject.toml
deleted file mode 100644
index b30cc53bda6..00000000000
--- a/tests/fixtures/with_default_source_legacy/pyproject.toml
+++ /dev/null
@@ -1,61 +0,0 @@
-[tool.poetry]
-name = "default-source-legacy"
-version = "1.2.3"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-license = "MIT"
-
-readme = "README.rst"
-
-homepage = "https://python-poetry.org"
-repository = "https://github.com/python-poetry/poetry"
-documentation = "https://python-poetry.org/docs"
-
-keywords = ["packaging", "dependency", "poetry"]
-
-classifiers = [
- "Topic :: Software Development :: Build Tools",
- "Topic :: Software Development :: Libraries :: Python Modules"
-]
-
-# Requirements
-[tool.poetry.dependencies]
-python = "^3.6"
-cleo = "^0.6"
-pendulum = { git = "https://github.com/sdispater/pendulum.git", branch = "2.0" }
-requests = { version = "^2.18", optional = true, extras=[ "security" ] }
-pathlib2 = { version = "^2.2", python = "~3.6" }
-
-orator = { version = "^0.9", optional = true }
-
-# File dependency
-demo = { path = "../distributions/demo-0.1.0-py2.py3-none-any.whl" }
-
-# Dir dependency with setup.py
-my-package = { path = "../project_with_setup/" }
-
-# Dir dependency with pyproject.toml
-simple-project = { path = "../simple_project/" }
-
-
-[tool.poetry.extras]
-db = [ "orator" ]
-
-[tool.poetry.group.dev.dependencies]
-pytest = "~3.4"
-
-
-[tool.poetry.scripts]
-my-script = "default_source_legacy:main"
-
-
-[tool.poetry.plugins."blogtool.parsers"]
-".rst" = "some_module::SomeClass"
-
-
-[[tool.poetry.source]]
-name = "foo"
-url = "https://foo.bar/simple/"
-default = true
diff --git a/tests/fixtures/with_default_source_pypi/README.rst b/tests/fixtures/with_default_source_pypi/README.rst
deleted file mode 100644
index f7fe15470f9..00000000000
--- a/tests/fixtures/with_default_source_pypi/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-My Package
-==========
diff --git a/tests/fixtures/with_default_source_pypi/pyproject.toml b/tests/fixtures/with_default_source_pypi/pyproject.toml
deleted file mode 100644
index c3fcb9380a6..00000000000
--- a/tests/fixtures/with_default_source_pypi/pyproject.toml
+++ /dev/null
@@ -1,60 +0,0 @@
-[tool.poetry]
-name = "with-default-source-pypi"
-version = "1.2.3"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-license = "MIT"
-
-readme = "README.rst"
-
-homepage = "https://python-poetry.org"
-repository = "https://github.com/python-poetry/poetry"
-documentation = "https://python-poetry.org/docs"
-
-keywords = ["packaging", "dependency", "poetry"]
-
-classifiers = [
- "Topic :: Software Development :: Build Tools",
- "Topic :: Software Development :: Libraries :: Python Modules"
-]
-
-# Requirements
-[tool.poetry.dependencies]
-python = "^3.6"
-cleo = "^0.6"
-pendulum = { git = "https://github.com/sdispater/pendulum.git", branch = "2.0" }
-requests = { version = "^2.18", optional = true, extras=[ "security" ] }
-pathlib2 = { version = "^2.2", python = "~3.6" }
-
-orator = { version = "^0.9", optional = true }
-
-# File dependency
-demo = { path = "../distributions/demo-0.1.0-py2.py3-none-any.whl" }
-
-# Dir dependency with setup.py
-my-package = { path = "../project_with_setup/" }
-
-# Dir dependency with pyproject.toml
-simple-project = { path = "../simple_project/" }
-
-
-[tool.poetry.extras]
-db = [ "orator" ]
-
-[tool.poetry.group.dev.dependencies]
-pytest = "~3.4"
-
-
-[tool.poetry.scripts]
-my-script = "my_package:main"
-
-
-[tool.poetry.plugins."blogtool.parsers"]
-".rst" = "some_module::SomeClass"
-
-
-[[tool.poetry.source]]
-name = "PyPI"
-priority = "default"
diff --git a/tests/fixtures/with_non_default_multiple_sources/pyproject.toml b/tests/fixtures/with_multiple_sources/pyproject.toml
similarity index 93%
rename from tests/fixtures/with_non_default_multiple_sources/pyproject.toml
rename to tests/fixtures/with_multiple_sources/pyproject.toml
index b3063e47827..ecce7e62590 100644
--- a/tests/fixtures/with_non_default_multiple_sources/pyproject.toml
+++ b/tests/fixtures/with_multiple_sources/pyproject.toml
@@ -16,7 +16,7 @@ python = "^3.6"
[[tool.poetry.source]]
name = "foo"
url = "https://foo.bar/simple/"
-priority = "secondary"
+priority = "supplemental"
[[tool.poetry.source]]
name = "bar"
diff --git a/tests/fixtures/with_non_default_multiple_sources_pypi/pyproject.toml b/tests/fixtures/with_multiple_sources_pypi/pyproject.toml
similarity index 94%
rename from tests/fixtures/with_non_default_multiple_sources_pypi/pyproject.toml
rename to tests/fixtures/with_multiple_sources_pypi/pyproject.toml
index 9e71ff764c8..1e4da135677 100644
--- a/tests/fixtures/with_non_default_multiple_sources_pypi/pyproject.toml
+++ b/tests/fixtures/with_multiple_sources_pypi/pyproject.toml
@@ -16,7 +16,7 @@ python = "^3.6"
[[tool.poetry.source]]
name = "foo"
url = "https://foo.bar/simple/"
-priority = "secondary"
+priority = "supplemental"
[[tool.poetry.source]]
name = "bar"
diff --git a/tests/fixtures/with_non_default_multiple_secondary_sources/pyproject.toml b/tests/fixtures/with_multiple_supplemental_sources/pyproject.toml
similarity index 88%
rename from tests/fixtures/with_non_default_multiple_secondary_sources/pyproject.toml
rename to tests/fixtures/with_multiple_supplemental_sources/pyproject.toml
index 517c37cc176..79f974dc780 100644
--- a/tests/fixtures/with_non_default_multiple_secondary_sources/pyproject.toml
+++ b/tests/fixtures/with_multiple_supplemental_sources/pyproject.toml
@@ -16,9 +16,9 @@ python = "^3.6"
[[tool.poetry.source]]
name = "foo"
url = "https://foo.bar/simple/"
-priority = "secondary"
+priority = "supplemental"
[[tool.poetry.source]]
name = "bar"
url = "https://bar.baz/simple/"
-priority = "secondary"
+priority = "supplemental"
diff --git a/tests/fixtures/with_non_default_multiple_secondary_sources_legacy/pyproject.toml b/tests/fixtures/with_non_default_multiple_secondary_sources_legacy/pyproject.toml
deleted file mode 100644
index 366db7461a8..00000000000
--- a/tests/fixtures/with_non_default_multiple_secondary_sources_legacy/pyproject.toml
+++ /dev/null
@@ -1,24 +0,0 @@
-[tool.poetry]
-name = "my-package"
-version = "1.2.3"
-description = "Some description."
-authors = [
- "Your Name "
-]
-license = "MIT"
-
-# Requirements
-[tool.poetry.dependencies]
-python = "^3.6"
-
-[tool.poetry.group.dev.dependencies]
-
-[[tool.poetry.source]]
-name = "foo"
-url = "https://foo.bar/simple/"
-secondary = true
-
-[[tool.poetry.source]]
-name = "bar"
-url = "https://bar.baz/simple/"
-secondary = true
diff --git a/tests/fixtures/with_non_default_multiple_sources_legacy/pyproject.toml b/tests/fixtures/with_non_default_multiple_sources_legacy/pyproject.toml
deleted file mode 100644
index 61f8e9bc59d..00000000000
--- a/tests/fixtures/with_non_default_multiple_sources_legacy/pyproject.toml
+++ /dev/null
@@ -1,23 +0,0 @@
-[tool.poetry]
-name = "my-package"
-version = "1.2.3"
-description = "Some description."
-authors = [
- "Your Name "
-]
-license = "MIT"
-
-# Requirements
-[tool.poetry.dependencies]
-python = "^3.6"
-
-[tool.poetry.group.dev.dependencies]
-
-[[tool.poetry.source]]
-name = "foo"
-url = "https://foo.bar/simple/"
-secondary = true
-
-[[tool.poetry.source]]
-name = "bar"
-url = "https://bar.baz/simple/"
diff --git a/tests/fixtures/with_non_default_secondary_source/pyproject.toml b/tests/fixtures/with_non_default_secondary_source/pyproject.toml
deleted file mode 100644
index 7a8004cac32..00000000000
--- a/tests/fixtures/with_non_default_secondary_source/pyproject.toml
+++ /dev/null
@@ -1,19 +0,0 @@
-[tool.poetry]
-name = "my-package"
-version = "1.2.3"
-description = "Some description."
-authors = [
- "Your Name "
-]
-license = "MIT"
-
-# Requirements
-[tool.poetry.dependencies]
-python = "^3.6"
-
-[tool.poetry.group.dev.dependencies]
-
-[[tool.poetry.source]]
-name = "foo"
-url = "https://foo.bar/simple/"
-priority = "secondary"
diff --git a/tests/fixtures/with_non_default_secondary_source_legacy/pyproject.toml b/tests/fixtures/with_non_default_secondary_source_legacy/pyproject.toml
deleted file mode 100644
index 980d78eecc9..00000000000
--- a/tests/fixtures/with_non_default_secondary_source_legacy/pyproject.toml
+++ /dev/null
@@ -1,19 +0,0 @@
-[tool.poetry]
-name = "my-package"
-version = "1.2.3"
-description = "Some description."
-authors = [
- "Your Name "
-]
-license = "MIT"
-
-# Requirements
-[tool.poetry.dependencies]
-python = "^3.6"
-
-[tool.poetry.group.dev.dependencies]
-
-[[tool.poetry.source]]
-name = "foo"
-url = "https://foo.bar/simple/"
-secondary = true
diff --git a/tests/fixtures/with_non_default_source_explicit/pyproject.toml b/tests/fixtures/with_primary_source_explicit/pyproject.toml
similarity index 100%
rename from tests/fixtures/with_non_default_source_explicit/pyproject.toml
rename to tests/fixtures/with_primary_source_explicit/pyproject.toml
diff --git a/tests/fixtures/with_non_default_source_implicit/pyproject.toml b/tests/fixtures/with_primary_source_implicit/pyproject.toml
similarity index 100%
rename from tests/fixtures/with_non_default_source_implicit/pyproject.toml
rename to tests/fixtures/with_primary_source_implicit/pyproject.toml
diff --git a/tests/fixtures/with_default_source/README.rst b/tests/fixtures/with_source/README.rst
similarity index 100%
rename from tests/fixtures/with_default_source/README.rst
rename to tests/fixtures/with_source/README.rst
diff --git a/tests/fixtures/with_default_source/pyproject.toml b/tests/fixtures/with_source/pyproject.toml
similarity index 96%
rename from tests/fixtures/with_default_source/pyproject.toml
rename to tests/fixtures/with_source/pyproject.toml
index bc0c4ac42b1..49fa2f62d71 100644
--- a/tests/fixtures/with_default_source/pyproject.toml
+++ b/tests/fixtures/with_source/pyproject.toml
@@ -1,5 +1,5 @@
[tool.poetry]
-name = "with-default-source"
+name = "with-source"
version = "1.2.3"
description = "Some description."
authors = [
@@ -58,4 +58,3 @@ my-script = "with_default_source:main"
[[tool.poetry.source]]
name = "foo"
url = "https://foo.bar/simple/"
-priority = "default"
diff --git a/tests/fixtures/with_two_default_sources/README.rst b/tests/fixtures/with_two_default_sources/README.rst
deleted file mode 100644
index f7fe15470f9..00000000000
--- a/tests/fixtures/with_two_default_sources/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-My Package
-==========
diff --git a/tests/fixtures/with_two_default_sources/pyproject.toml b/tests/fixtures/with_two_default_sources/pyproject.toml
deleted file mode 100644
index 6f05f22eba1..00000000000
--- a/tests/fixtures/with_two_default_sources/pyproject.toml
+++ /dev/null
@@ -1,66 +0,0 @@
-[tool.poetry]
-name = "two-default-sources"
-version = "1.2.3"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-license = "MIT"
-
-readme = "README.rst"
-
-homepage = "https://python-poetry.org"
-repository = "https://github.com/python-poetry/poetry"
-documentation = "https://python-poetry.org/docs"
-
-keywords = ["packaging", "dependency", "poetry"]
-
-classifiers = [
- "Topic :: Software Development :: Build Tools",
- "Topic :: Software Development :: Libraries :: Python Modules"
-]
-
-# Requirements
-[tool.poetry.dependencies]
-python = "^3.6"
-cleo = "^0.6"
-pendulum = { git = "https://github.com/sdispater/pendulum.git", branch = "2.0" }
-requests = { version = "^2.18", optional = true, extras=[ "security" ] }
-pathlib2 = { version = "^2.2", python = "~3.6" }
-
-orator = { version = "^0.9", optional = true }
-
-# File dependency
-demo = { path = "../distributions/demo-0.1.0-py2.py3-none-any.whl" }
-
-# Dir dependency with setup.py
-my-package = { path = "../project_with_setup/" }
-
-# Dir dependency with pyproject.toml
-simple-project = { path = "../simple_project/" }
-
-
-[tool.poetry.extras]
-db = [ "orator" ]
-
-[tool.poetry.group.dev.dependencies]
-pytest = "~3.4"
-
-
-[tool.poetry.scripts]
-my-script = "two_default_sources:main"
-
-
-[tool.poetry.plugins."blogtool.parsers"]
-".rst" = "some_module::SomeClass"
-
-
-[[tool.poetry.source]]
-name = "foo"
-url = "https://foo.bar/simple/"
-priority = "default"
-
-[[tool.poetry.source]]
-name = "bar"
-url = "https://bar.foo/simple/"
-priority = "default"
diff --git a/tests/fixtures/with_two_default_sources_legacy/README.rst b/tests/fixtures/with_two_default_sources_legacy/README.rst
deleted file mode 100644
index f7fe15470f9..00000000000
--- a/tests/fixtures/with_two_default_sources_legacy/README.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-My Package
-==========
diff --git a/tests/fixtures/with_two_default_sources_legacy/pyproject.toml b/tests/fixtures/with_two_default_sources_legacy/pyproject.toml
deleted file mode 100644
index 0de036eb8c8..00000000000
--- a/tests/fixtures/with_two_default_sources_legacy/pyproject.toml
+++ /dev/null
@@ -1,66 +0,0 @@
-[tool.poetry]
-name = "two-default-sources-legacy"
-version = "1.2.3"
-description = "Some description."
-authors = [
- "Sébastien Eustace "
-]
-license = "MIT"
-
-readme = "README.rst"
-
-homepage = "https://python-poetry.org"
-repository = "https://github.com/python-poetry/poetry"
-documentation = "https://python-poetry.org/docs"
-
-keywords = ["packaging", "dependency", "poetry"]
-
-classifiers = [
- "Topic :: Software Development :: Build Tools",
- "Topic :: Software Development :: Libraries :: Python Modules"
-]
-
-# Requirements
-[tool.poetry.dependencies]
-python = "^3.6"
-cleo = "^0.6"
-pendulum = { git = "https://github.com/sdispater/pendulum.git", branch = "2.0" }
-requests = { version = "^2.18", optional = true, extras=[ "security" ] }
-pathlib2 = { version = "^2.2", python = "~3.6" }
-
-orator = { version = "^0.9", optional = true }
-
-# File dependency
-demo = { path = "../distributions/demo-0.1.0-py2.py3-none-any.whl" }
-
-# Dir dependency with setup.py
-my-package = { path = "../project_with_setup/" }
-
-# Dir dependency with pyproject.toml
-simple-project = { path = "../simple_project/" }
-
-
-[tool.poetry.extras]
-db = [ "orator" ]
-
-[tool.poetry.group.dev.dependencies]
-pytest = "~3.4"
-
-
-[tool.poetry.scripts]
-my-script = "two_default_sources_legacy:main"
-
-
-[tool.poetry.plugins."blogtool.parsers"]
-".rst" = "some_module::SomeClass"
-
-
-[[tool.poetry.source]]
-name = "foo"
-url = "https://foo.bar/simple/"
-default = true
-
-[[tool.poetry.source]]
-name = "bar"
-url = "https://bar.foo/simple/"
-default = true
diff --git a/tests/json/fixtures/source/complete_invalid_priority_legacy_and_new.toml b/tests/json/fixtures/source/complete_invalid_priority_legacy_and_new.toml
deleted file mode 100644
index 4e2789b49d8..00000000000
--- a/tests/json/fixtures/source/complete_invalid_priority_legacy_and_new.toml
+++ /dev/null
@@ -1,18 +0,0 @@
-[tool.poetry]
-name = "foobar"
-version = "0.1.0"
-description = ""
-authors = ["Your Name "]
-
-[tool.poetry.dependencies]
-python = "^3.10"
-
-[[tool.poetry.source]]
-name = "pypi-simple"
-url = "https://pypi.org/simple/"
-default = false
-priority = "primary"
-
-[build-system]
-requires = ["poetry-core"]
-build-backend = "poetry.core.masonry.api"
diff --git a/tests/json/fixtures/source/complete_valid_legacy.toml b/tests/json/fixtures/source/complete_valid_legacy.toml
deleted file mode 100644
index d0b4565ffa4..00000000000
--- a/tests/json/fixtures/source/complete_valid_legacy.toml
+++ /dev/null
@@ -1,18 +0,0 @@
-[tool.poetry]
-name = "foobar"
-version = "0.1.0"
-description = ""
-authors = ["Your Name "]
-
-[tool.poetry.dependencies]
-python = "^3.10"
-
-[[tool.poetry.source]]
-name = "pypi-simple"
-url = "https://pypi.org/simple/"
-default = false
-secondary = false
-
-[build-system]
-requires = ["poetry-core"]
-build-backend = "poetry.core.masonry.api"
diff --git a/tests/json/test_schema_sources.py b/tests/json/test_schema_sources.py
index 9e5d6fca50b..307cfba3aa6 100644
--- a/tests/json/test_schema_sources.py
+++ b/tests/json/test_schema_sources.py
@@ -10,11 +10,6 @@
FIXTURE_DIR = Path(__file__).parent / "fixtures" / "source"
-def test_pyproject_toml_valid_legacy() -> None:
- toml: dict[str, Any] = TOMLFile(FIXTURE_DIR / "complete_valid_legacy.toml").read()
- assert Factory.validate(toml) == {"errors": [], "warnings": []}
-
-
def test_pyproject_toml_valid() -> None:
toml: dict[str, Any] = TOMLFile(FIXTURE_DIR / "complete_valid.toml").read()
assert Factory.validate(toml) == {"errors": [], "warnings": []}
@@ -26,18 +21,8 @@ def test_pyproject_toml_invalid_priority() -> None:
).read()
assert Factory.validate(toml) == {
"errors": [
- "data.source[0].priority must be one of ['primary', 'default', "
- "'secondary', 'supplemental', 'explicit']"
+ "data.source[0].priority must be one of ['primary',"
+ " 'supplemental', 'explicit']"
],
"warnings": [],
}
-
-
-def test_pyproject_toml_invalid_priority_legacy_and_new() -> None:
- toml: dict[str, Any] = TOMLFile(
- FIXTURE_DIR / "complete_invalid_priority_legacy_and_new.toml"
- ).read()
- assert Factory.validate(toml) == {
- "errors": ["data.source[0] must NOT match a disallowed definition"],
- "warnings": [],
- }
diff --git a/tests/publishing/test_publisher.py b/tests/publishing/test_publisher.py
index a68885e9a91..db1c7b4d62f 100644
--- a/tests/publishing/test_publisher.py
+++ b/tests/publishing/test_publisher.py
@@ -43,7 +43,7 @@ def test_publish_publishes_to_pypi_by_default(
]
-@pytest.mark.parametrize("fixture_name", ["sample_project", "with_default_source"])
+@pytest.mark.parametrize("fixture_name", ["sample_project", "with_source"])
def test_publish_can_publish_to_given_repository(
fixture_dir: FixtureDirGetter,
mocker: MockerFixture,
diff --git a/tests/puzzle/test_solver.py b/tests/puzzle/test_solver.py
index 5c2fc8496ce..2659e209715 100644
--- a/tests/puzzle/test_solver.py
+++ b/tests/puzzle/test_solver.py
@@ -3179,7 +3179,7 @@ def test_solver_chooses_from_correct_repository_if_forced_and_transitive_depende
assert ops[1].package.source_url is None
-def test_solver_does_not_choose_from_secondary_repository_by_default(
+def test_solver_does_not_choose_from_supplemental_repository_by_default(
package: ProjectPackage,
io: NullIO,
legacy_repository: LegacyRepository,
@@ -3189,7 +3189,7 @@ def test_solver_does_not_choose_from_secondary_repository_by_default(
package.add_dependency(Factory.create_dependency("clikit", {"version": "^0.2.0"}))
pool = RepositoryPool()
- pool.add_repository(pypi_repository, priority=Priority.SECONDARY)
+ pool.add_repository(pypi_repository, priority=Priority.SUPPLEMENTAL)
pool.add_repository(legacy_repository)
solver = Solver(package, pool, [], [], io)
@@ -3229,7 +3229,7 @@ def test_solver_does_not_choose_from_secondary_repository_by_default(
assert ops[2].package.source_url == legacy_repository.url
-def test_solver_chooses_from_secondary_if_explicit(
+def test_solver_chooses_from_supplemental_if_explicit(
package: ProjectPackage,
io: NullIO,
legacy_repository: LegacyRepository,
@@ -3241,7 +3241,7 @@ def test_solver_chooses_from_secondary_if_explicit(
)
pool = RepositoryPool()
- pool.add_repository(pypi_repository, priority=Priority.SECONDARY)
+ pool.add_repository(pypi_repository, priority=Priority.SUPPLEMENTAL)
pool.add_repository(legacy_repository)
solver = Solver(package, pool, [], [], io)
diff --git a/tests/repositories/test_repository_pool.py b/tests/repositories/test_repository_pool.py
index 87d5782170e..056b1b0ee50 100644
--- a/tests/repositories/test_repository_pool.py
+++ b/tests/repositories/test_repository_pool.py
@@ -17,7 +17,6 @@ def test_pool() -> None:
pool = RepositoryPool()
assert len(pool.repositories) == 0
- assert not pool.has_default()
assert not pool.has_primary_repositories()
@@ -26,7 +25,6 @@ def test_pool_with_initial_repositories() -> None:
pool = RepositoryPool([repo])
assert len(pool.repositories) == 1
- assert not pool.has_default()
assert pool.has_primary_repositories()
assert pool.get_priority("repo") == Priority.PRIMARY
@@ -71,30 +69,7 @@ def test_repository_from_single_repo_pool(priority: Priority) -> None:
assert pool.get_priority("foo") == priority
-@pytest.mark.parametrize(
- ("default", "secondary", "expected_priority"),
- [
- (False, True, Priority.SECONDARY),
- (True, False, Priority.DEFAULT),
- (True, True, Priority.DEFAULT),
- ],
-)
-def test_repository_from_single_repo_pool_legacy(
- default: bool, secondary: bool, expected_priority: Priority
-) -> None:
- repo = LegacyRepository("foo", "https://foo.bar")
- pool = RepositoryPool()
-
- with pytest.warns(DeprecationWarning):
- pool.add_repository(repo, default=default, secondary=secondary)
-
- assert pool.repository("foo") is repo
- assert pool.get_priority("foo") == expected_priority
-
-
def test_repository_with_all_prio_repositories() -> None:
- secondary = LegacyRepository("secondary", "https://secondary.com")
- default = LegacyRepository("default", "https://default.com")
supplemental = LegacyRepository("supplemental", "https://supplemental.com")
repo1 = LegacyRepository("foo", "https://foo.bar")
repo2 = LegacyRepository("bar", "https://bar.baz")
@@ -102,47 +77,39 @@ def test_repository_with_all_prio_repositories() -> None:
pool = RepositoryPool()
pool.add_repository(repo1)
- pool.add_repository(secondary, priority=Priority.SECONDARY)
pool.add_repository(repo2)
pool.add_repository(supplemental, priority=Priority.SUPPLEMENTAL)
pool.add_repository(explicit, priority=Priority.EXPLICIT)
- pool.add_repository(default, priority=Priority.DEFAULT)
- assert pool.repository("secondary") is secondary
- assert pool.repository("default") is default
assert pool.repository("foo") is repo1
assert pool.repository("bar") is repo2
assert pool.repository("supplemental") is supplemental
assert pool.repository("explicit") is explicit
- assert pool.has_default()
assert pool.has_primary_repositories()
-def test_repository_secondary_and_supplemental_repositories_do_show() -> None:
- secondary = LegacyRepository("secondary", "https://secondary.com")
+def test_repository_supplemental_repositories_do_show() -> None:
supplemental = LegacyRepository("supplemental", "https://supplemental.com")
pool = RepositoryPool()
- pool.add_repository(secondary, priority=Priority.SECONDARY)
pool.add_repository(supplemental, priority=Priority.SUPPLEMENTAL)
- assert pool.repository("secondary") is secondary
assert pool.repository("supplemental") is supplemental
- assert pool.repositories == [secondary, supplemental]
+ assert pool.repositories == [supplemental]
def test_repository_explicit_repositories_do_not_show() -> None:
explicit = LegacyRepository("explicit", "https://explicit.com")
- default = LegacyRepository("default", "https://default.com")
+ primary = LegacyRepository("primary", "https://primary.com")
pool = RepositoryPool()
pool.add_repository(explicit, priority=Priority.EXPLICIT)
- pool.add_repository(default, priority=Priority.DEFAULT)
+ pool.add_repository(primary, priority=Priority.PRIMARY)
assert pool.repository("explicit") is explicit
- assert pool.repository("default") is default
- assert pool.repositories == [default]
- assert pool.all_repositories == [default, explicit]
+ assert pool.repository("primary") is primary
+ assert pool.repositories == [primary]
+ assert pool.all_repositories == [primary, explicit]
def test_remove_non_existing_repository_raises_indexerror() -> None:
@@ -168,65 +135,26 @@ def test_remove_existing_repository_successful() -> None:
assert pool.repository("baz") is repo3
-def test_remove_default_repository() -> None:
- default = LegacyRepository("default", "https://default.com")
- repo1 = LegacyRepository("foo", "https://foo.bar")
- repo2 = LegacyRepository("bar", "https://bar.baz")
- new_default = LegacyRepository("new_default", "https://new.default.com")
-
- pool = RepositoryPool()
- pool.add_repository(repo1)
- pool.add_repository(repo2)
- pool.add_repository(default, priority=Priority.DEFAULT)
-
- assert pool.has_default()
-
- pool.remove_repository("default")
-
- assert not pool.has_repository("default")
- assert not pool.has_default()
-
- pool.add_repository(new_default, priority=Priority.DEFAULT)
-
- assert pool.get_priority("new_default") is Priority.DEFAULT
- assert pool.has_default()
-
-
def test_repository_ordering() -> None:
- default1 = LegacyRepository("default1", "https://default1.com")
- default2 = LegacyRepository("default2", "https://default2.com")
primary1 = LegacyRepository("primary1", "https://primary1.com")
primary2 = LegacyRepository("primary2", "https://primary2.com")
primary3 = LegacyRepository("primary3", "https://primary3.com")
- secondary1 = LegacyRepository("secondary1", "https://secondary1.com")
- secondary2 = LegacyRepository("secondary2", "https://secondary2.com")
- secondary3 = LegacyRepository("secondary3", "https://secondary3.com")
supplemental = LegacyRepository("supplemental", "https://supplemental.com")
pool = RepositoryPool()
- pool.add_repository(secondary1, priority=Priority.SECONDARY)
pool.add_repository(supplemental, priority=Priority.SUPPLEMENTAL)
pool.add_repository(primary1)
- pool.add_repository(default1, priority=Priority.DEFAULT)
pool.add_repository(primary2)
- pool.add_repository(secondary2, priority=Priority.SECONDARY)
pool.remove_repository("primary2")
- pool.remove_repository("secondary2")
pool.add_repository(primary3)
- pool.add_repository(secondary3, priority=Priority.SECONDARY)
assert pool.repositories == [
- default1,
primary1,
primary3,
- secondary1,
- secondary3,
supplemental,
]
- with pytest.raises(ValueError):
- pool.add_repository(default2, priority=Priority.DEFAULT)
def test_pool_get_package_in_any_repository() -> None:
diff --git a/tests/test_factory.py b/tests/test_factory.py
index 2b38b60a1e8..a05dd2fbb86 100644
--- a/tests/test_factory.py
+++ b/tests/test_factory.py
@@ -230,67 +230,16 @@ def test_create_poetry_non_package_mode(fixture_dir: FixtureDirGetter) -> None:
assert not poetry.is_package_mode
-def test_poetry_with_default_source_legacy(
- fixture_dir: FixtureDirGetter, with_simple_keyring: None
-) -> None:
- io = BufferedIO()
- poetry = Factory().create_poetry(fixture_dir("with_default_source_legacy"), io=io)
-
- assert len(poetry.pool.repositories) == 1
- assert "Found deprecated key" in io.fetch_error()
-
-
-def test_poetry_with_default_source(
- fixture_dir: FixtureDirGetter, with_simple_keyring: None
-) -> None:
- io = BufferedIO()
- poetry = Factory().create_poetry(fixture_dir("with_default_source"), io=io)
-
- assert len(poetry.pool.repositories) == 1
- assert (
- io.fetch_error().strip()
- == "Warning: Found deprecated priority 'default' for source 'foo' in"
- " pyproject.toml. You can achieve the same effect by changing the priority"
- " to 'primary' and putting the source first."
- )
-
-
-def test_poetry_with_default_source_and_pypi(
- fixture_dir: FixtureDirGetter, with_simple_keyring: None
-) -> None:
- io = BufferedIO()
- poetry = Factory().create_poetry(fixture_dir("with_default_source_and_pypi"), io=io)
-
- assert len(poetry.pool.repositories) == 2
- assert poetry.pool.has_repository("PyPI")
- assert isinstance(poetry.pool.repository("PyPI"), PyPiRepository)
- assert poetry.pool.get_priority("PyPI") is Priority.PRIMARY
- assert "Warning: Found deprecated key" not in io.fetch_error()
-
-
-def test_poetry_with_default_source_pypi(
- fixture_dir: FixtureDirGetter, with_simple_keyring: None
-) -> None:
- io = BufferedIO()
- poetry = Factory().create_poetry(fixture_dir("with_default_source_pypi"), io=io)
-
- assert len(poetry.pool.repositories) == 1
- assert poetry.pool.has_repository("PyPI")
- assert isinstance(poetry.pool.repository("PyPI"), PyPiRepository)
- assert poetry.pool.get_priority("PyPI") is Priority.DEFAULT
-
-
@pytest.mark.parametrize(
"project",
- ("with_non_default_source_implicit", "with_non_default_source_explicit"),
+ ("with_primary_source_implicit", "with_primary_source_explicit"),
)
-def test_poetry_with_non_default_source(
+def test_poetry_with_primary_source(
project: str, fixture_dir: FixtureDirGetter, with_simple_keyring: None
) -> None:
io = BufferedIO()
poetry = Factory().create_poetry(fixture_dir(project), io=io)
- assert not poetry.pool.has_default()
assert not poetry.pool.has_repository("PyPI")
assert poetry.pool.has_repository("foo")
assert poetry.pool.get_priority("foo") is Priority.PRIMARY
@@ -298,41 +247,10 @@ def test_poetry_with_non_default_source(
assert {repo.name for repo in poetry.pool.repositories} == {"foo"}
-def test_poetry_with_non_default_secondary_source_legacy(
+def test_poetry_with_multiple_supplemental_sources(
fixture_dir: FixtureDirGetter, with_simple_keyring: None
) -> None:
- poetry = Factory().create_poetry(
- fixture_dir("with_non_default_secondary_source_legacy")
- )
-
- assert poetry.pool.has_repository("PyPI")
- assert isinstance(poetry.pool.repository("PyPI"), PyPiRepository)
- assert poetry.pool.get_priority("PyPI") is Priority.PRIMARY
- assert poetry.pool.has_repository("foo")
- assert isinstance(poetry.pool.repository("foo"), LegacyRepository)
- assert {repo.name for repo in poetry.pool.repositories} == {"PyPI", "foo"}
-
-
-def test_poetry_with_non_default_secondary_source(
- fixture_dir: FixtureDirGetter, with_simple_keyring: None
-) -> None:
- poetry = Factory().create_poetry(fixture_dir("with_non_default_secondary_source"))
-
- assert poetry.pool.has_repository("PyPI")
- assert isinstance(poetry.pool.repository("PyPI"), PyPiRepository)
- assert poetry.pool.get_priority("PyPI") is Priority.PRIMARY
- assert poetry.pool.has_repository("foo")
- assert isinstance(poetry.pool.repository("foo"), LegacyRepository)
- assert {repo.name for repo in poetry.pool.repositories} == {"PyPI", "foo"}
-
-
-def test_poetry_with_non_default_multiple_secondary_sources_legacy(
- fixture_dir: FixtureDirGetter,
- with_simple_keyring: None,
-) -> None:
- poetry = Factory().create_poetry(
- fixture_dir("with_non_default_multiple_secondary_sources_legacy")
- )
+ poetry = Factory().create_poetry(fixture_dir("with_multiple_supplemental_sources"))
assert poetry.pool.has_repository("PyPI")
assert isinstance(poetry.pool.repository("PyPI"), PyPiRepository)
@@ -344,45 +262,11 @@ def test_poetry_with_non_default_multiple_secondary_sources_legacy(
assert {repo.name for repo in poetry.pool.repositories} == {"PyPI", "foo", "bar"}
-def test_poetry_with_non_default_multiple_secondary_sources(
- fixture_dir: FixtureDirGetter, with_simple_keyring: None
-) -> None:
- poetry = Factory().create_poetry(
- fixture_dir("with_non_default_multiple_secondary_sources")
- )
-
- assert poetry.pool.has_repository("PyPI")
- assert isinstance(poetry.pool.repository("PyPI"), PyPiRepository)
- assert poetry.pool.get_priority("PyPI") is Priority.PRIMARY
- assert poetry.pool.has_repository("foo")
- assert isinstance(poetry.pool.repository("foo"), LegacyRepository)
- assert poetry.pool.has_repository("bar")
- assert isinstance(poetry.pool.repository("bar"), LegacyRepository)
- assert {repo.name for repo in poetry.pool.repositories} == {"PyPI", "foo", "bar"}
-
-
-def test_poetry_with_non_default_multiple_sources_legacy(
- fixture_dir: FixtureDirGetter, with_simple_keyring: None
-) -> None:
- poetry = Factory().create_poetry(
- fixture_dir("with_non_default_multiple_sources_legacy")
- )
-
- assert not poetry.pool.has_default()
- assert poetry.pool.has_repository("bar")
- assert isinstance(poetry.pool.repository("bar"), LegacyRepository)
- assert not poetry.pool.has_repository("PyPI")
- assert poetry.pool.has_repository("foo")
- assert isinstance(poetry.pool.repository("foo"), LegacyRepository)
- assert {repo.name for repo in poetry.pool.repositories} == {"bar", "foo"}
-
-
-def test_poetry_with_non_default_multiple_sources(
+def test_poetry_with_multiple_sources(
fixture_dir: FixtureDirGetter, with_simple_keyring: None
) -> None:
- poetry = Factory().create_poetry(fixture_dir("with_non_default_multiple_sources"))
+ poetry = Factory().create_poetry(fixture_dir("with_multiple_sources"))
- assert not poetry.pool.has_default()
assert not poetry.pool.has_repository("PyPI")
assert poetry.pool.has_repository("bar")
assert isinstance(poetry.pool.repository("bar"), LegacyRepository)
@@ -391,29 +275,19 @@ def test_poetry_with_non_default_multiple_sources(
assert {repo.name for repo in poetry.pool.repositories} == {"bar", "foo"}
-def test_poetry_with_non_default_multiple_sources_pypi(
+def test_poetry_with_multiple_sources_pypi(
fixture_dir: FixtureDirGetter, with_simple_keyring: None
) -> None:
io = BufferedIO()
- poetry = Factory().create_poetry(
- fixture_dir("with_non_default_multiple_sources_pypi"), io=io
- )
+ poetry = Factory().create_poetry(fixture_dir("with_multiple_sources_pypi"), io=io)
assert len(poetry.pool.repositories) == 4
- assert not poetry.pool.has_default()
assert poetry.pool.has_repository("PyPI")
assert isinstance(poetry.pool.repository("PyPI"), PyPiRepository)
assert poetry.pool.get_priority("PyPI") is Priority.PRIMARY
# PyPI must be between bar and baz!
expected = ["bar", "PyPI", "baz", "foo"]
assert [repo.name for repo in poetry.pool.repositories] == expected
- error = io.fetch_error()
- assert (
- error.strip()
- == "Warning: Found deprecated priority 'secondary' for source 'foo' in"
- " pyproject.toml. Consider changing the priority to one of the"
- " non-deprecated values: 'default', 'primary', 'supplemental', 'explicit'."
- )
def test_poetry_with_no_default_source(fixture_dir: FixtureDirGetter) -> None:
@@ -481,24 +355,6 @@ def test_poetry_with_pypi_explicit_only(
assert str(e.value) == "At least one source must not be configured as 'explicit'."
-def test_poetry_with_two_default_sources_legacy(
- fixture_dir: FixtureDirGetter, with_simple_keyring: None
-) -> None:
- with pytest.raises(ValueError) as e:
- Factory().create_poetry(fixture_dir("with_two_default_sources_legacy"))
-
- assert str(e.value) == "Only one repository can be the default."
-
-
-def test_poetry_with_two_default_sources(
- fixture_dir: FixtureDirGetter, with_simple_keyring: None
-) -> None:
- with pytest.raises(ValueError) as e:
- Factory().create_poetry(fixture_dir("with_two_default_sources"))
-
- assert str(e.value) == "Only one repository can be the default."
-
-
def test_validate(fixture_dir: FixtureDirGetter) -> None:
complete = TOMLFile(fixture_dir("complete.toml"))
pyproject: dict[str, Any] = complete.read()