Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add project name by default to already_handled_packages #202

Merged
merged 3 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ci_cd/tasks/update_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ def update_deps( # pylint: disable=too-many-branches,too-many-locals,too-many-s
)
py_version = match.group("version")

already_handled_packages = set()
# Skip package if it is this project (this can happen for inter-relative extra
# dependencies)
already_handled_packages = {pyproject["project"]["name"]}

updated_packages = {}
dependencies = pyproject.get("project", {}).get("dependencies", [])
for optional_deps in (
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ testing = [
dev = [
"pre-commit ~=2.21",
"pylint ~=2.13",
"ci-cd[docs,testing]",
]

[project.urls]
Expand Down
13 changes: 10 additions & 3 deletions tests/tasks/test_update_deps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Test `ci_cd.tasks.update_deps()`."""
# pylint: disable=line-too-long,too-many-lines,too-many-locals
# pylint: disable=line-too-long,too-many-lines,too-many-locals,too-many-branches
from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down Expand Up @@ -34,6 +34,7 @@ def test_update_deps(tmp_path: "Path", caplog: pytest.LogCaptureFixture) -> None
pyproject_file.write_text(
data=f"""
[project]
name = "test"
requires-python = "~=3.7"

dependencies = [
Expand All @@ -51,10 +52,9 @@ def test_update_deps(tmp_path: "Path", caplog: pytest.LogCaptureFixture) -> None
]
dev = [
"mike >={original_dependencies['mike']},<3",
"pytest ~={original_dependencies['pytest']}",
"pytest-cov ~={original_dependencies['pytest-cov']}",
"pre-commit ~={original_dependencies['pre-commit']}",
"pylint ~={original_dependencies['pylint']}",
"test[testing]",
]

# List from https://peps.python.org/pep-0508/#complete-grammar
Expand Down Expand Up @@ -161,6 +161,12 @@ def test_update_deps(tmp_path: "Path", caplog: pytest.LogCaptureFixture) -> None
"'name5 [fred,bar]' is pinned to a URL and will be skipped"
in caplog.text
)
elif "test[testing]" in line:
assert line == "test[testing]"
assert (
"'test[testing]' is not version restricted and will be skipped."
not in caplog.text
)
else:
pytest.fail(f"Unknown package in line: {line}")

Expand Down Expand Up @@ -1100,6 +1106,7 @@ def test_ignore_rules_logic(
pyproject_file.write_text(
data=f"""
[project]
name = "test"
requires-python = "~=3.7"

dependencies = [
Expand Down