diff --git a/.github/workflows/on-publish.yml b/.github/workflows/publish.yml similarity index 100% rename from .github/workflows/on-publish.yml rename to .github/workflows/publish.yml diff --git a/.github/workflows/on-release.yml b/.github/workflows/release.yml similarity index 100% rename from .github/workflows/on-release.yml rename to .github/workflows/release.yml diff --git a/.github/workflows/on-pr.yml b/.github/workflows/test.yml similarity index 99% rename from .github/workflows/on-pr.yml rename to .github/workflows/test.yml index 52b90a6..338413d 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,6 @@ on: - "*" jobs: - test: runs-on: ubuntu-latest strategy: diff --git a/README.md b/README.md index bd373f2..ef8bb78 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Poetry Plugin: upgrade -![release](https://github.com/apoclyps/poetry-plugin-upgrade/actions/workflows/on-release.yml/badge.svg) -![publish](https://github.com/apoclyps/poetry-plugin-upgrade/actions/workflows/on-publish.yml/badge.svg) -![test](https://github.com/apoclyps/poetry-plugin-upgrade/actions/workflows/on-pr.yml/badge.svg) +![release](https://github.com/apoclyps/poetry-plugin-upgrade/actions/workflows/release.yml/badge.svg) +![publish](https://github.com/apoclyps/poetry-plugin-upgrade/actions/workflows/publish.yml/badge.svg) +![test](https://github.com/apoclyps/poetry-plugin-upgrade/actions/workflows/test.yml/badge.svg) [![license](https://img.shields.io/badge/License-MIT-yellow)](LICENSE) ![python_version](https://img.shields.io/badge/Python-%3E=3.8-blue) ![poetry_version](https://img.shields.io/badge/Poetry-%3E=1.6-blue) diff --git a/src/poetry_plugin_upgrade/command.py b/src/poetry_plugin_upgrade/command.py index d408716..4ce86a9 100644 --- a/src/poetry_plugin_upgrade/command.py +++ b/src/poetry_plugin_upgrade/command.py @@ -206,14 +206,13 @@ def handle_version(current_version: str, candidate: Package) -> str: if current_version.startswith(">="): version_constraint = ">=" + elif current_version[0] == ">": + version_constraint = ">" if current_version.startswith("=="): version_constraint = "==" - if current_version[0] == ">": - version_constraint = ">" - - return f"{version_constraint}{candidate.pretty_version}" + return f"{version_constraint}{candidate.pretty_version}" if version_constraint else candidate.pretty_version @staticmethod def is_bumpable( diff --git a/tests/e2e/test_e2e.py b/tests/e2e/test_e2e.py index 4c17ac2..450d4f0 100644 --- a/tests/e2e/test_e2e.py +++ b/tests/e2e/test_e2e.py @@ -58,7 +58,7 @@ def test_command_with_latest( expected = PyProjectTOML(path).file.read() assert app_tester.execute("upgrade --latest") == 0 - assert dict(PyProjectTOML(tmp_pyproject_path).file.read()) == expected + assert PyProjectTOML(tmp_pyproject_path).file.read() == expected command_call.assert_called_once_with(name="update") diff --git a/tests/fixtures/simple_project/expected_pyproject_with_latest.toml b/tests/fixtures/simple_project/expected_pyproject_with_latest.toml index c09e141..3fe087b 100644 --- a/tests/fixtures/simple_project/expected_pyproject_with_latest.toml +++ b/tests/fixtures/simple_project/expected_pyproject_with_latest.toml @@ -19,11 +19,11 @@ waldo = { git = "https://example.com/test/project.git" } fred = "1.1.1" plugh = "^2.2.2" xyzzy = "~2.2.2" -nacho = "2.2.2" +nacho = "<1.1.1" thud = ">2.2.2" [tool.poetry.group.docs.dependencies] -foobar = "2.2.2" +foobar = "<=1.1.1" foobaz = ">=2.2.2" fooqux = "2.2.2" fooquux = "2.2.2" diff --git a/tests/fixtures/simple_project/expected_pyproject_with_latest_and_preserve_wildcard.toml b/tests/fixtures/simple_project/expected_pyproject_with_latest_and_preserve_wildcard.toml index 2d0f826..89ff26b 100644 --- a/tests/fixtures/simple_project/expected_pyproject_with_latest_and_preserve_wildcard.toml +++ b/tests/fixtures/simple_project/expected_pyproject_with_latest_and_preserve_wildcard.toml @@ -19,11 +19,11 @@ waldo = { git = "https://example.com/test/project.git" } fred = "1.1.1" plugh = "^2.2.2" xyzzy = "~2.2.2" -nacho = "2.2.2" +nacho = "<1.1.1" thud = ">2.2.2" [tool.poetry.group.docs.dependencies] -foobar = "2.2.2" +foobar = "<=1.1.1" foobaz = ">=2.2.2" fooqux = "2.2.2" fooquux = "*"