diff --git a/pontos/git/git.py b/pontos/git/git.py index 497ba840d..cc2ae1c14 100644 --- a/pontos/git/git.py +++ b/pontos/git/git.py @@ -19,7 +19,15 @@ from enum import Enum from os import PathLike, fspath from pathlib import Path -from typing import Collection, Iterable, Iterator, List, Optional, Union +from typing import ( + Collection, + Iterable, + Iterator, + List, + Optional, + Sequence, + Union, +) from pontos.errors import PontosError from pontos.git.status import StatusEntry, parse_git_status @@ -384,7 +392,7 @@ def list_tags( def add( self, - files: Union[str, PathLike[str], list[Union[PathLike[str], str]]], + files: Union[str, PathLike[str], Sequence[Union[PathLike[str], str]]], ) -> None: """ Add files to the git staging area diff --git a/pontos/version/commands/_command.py b/pontos/version/commands/_command.py index 706d91403..39d653b91 100644 --- a/pontos/version/commands/_command.py +++ b/pontos/version/commands/_command.py @@ -29,7 +29,9 @@ class VersionCommand(ABC): project_file_name: str - def __init__(self, versioning_scheme: VersioningScheme) -> None: + def __init__( + self, versioning_scheme: Union[VersioningScheme, type[VersioningScheme]] + ) -> None: self.project_file_path = Path.cwd() / self.project_file_name self.versioning_scheme = versioning_scheme diff --git a/tests/release/test_create.py b/tests/release/test_create.py index 364c2ad9e..0ec2eaccf 100644 --- a/tests/release/test_create.py +++ b/tests/release/test_create.py @@ -19,10 +19,10 @@ import unittest from contextlib import contextmanager -from dataclasses import dataclass, field +from dataclasses import dataclass from datetime import datetime from pathlib import Path -from typing import Iterable, Optional, Union +from typing import Iterable, Iterator, Optional, Union from unittest.mock import AsyncMock, MagicMock, call, patch from httpx import HTTPStatusError, Request, Response @@ -55,8 +55,8 @@ def str_or_list(values: Union[str, Iterable[str]]) -> Iterable[str]: @contextmanager def setup_go_project( - *, current_version: str, tags: Union[str, Iterable[str]] = None -) -> Path: + *, current_version: str, tags: Union[str, Iterable[str], None] = None +) -> Iterator[Path]: with temp_git_repository() as tmp_git: git = Git(tmp_git) @@ -182,12 +182,12 @@ def test_release_version( VersionUpdate( previous=current_version, new=release_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), VersionUpdate( previous=release_version, new=next_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), ] git_instance_mock: MagicMock = git_mock.return_value @@ -212,7 +212,7 @@ def test_release_version( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) git_instance_mock.push.assert_has_calls( @@ -230,12 +230,12 @@ def test_release_version( ) self.assertEqual( - create_release_mock.await_args.args[1:], + create_release_mock.await_args.args[1:], # type: ignore[union-attr] (release_version, "foo", "A Changelog", False), ) git_instance_mock.add.assert_has_calls( - [call("MyProject.conf"), call("MyProject.conf")] + [call(Path("MyProject.conf")), call(Path("MyProject.conf"))] ) git_instance_mock.commit.assert_has_calls( [ @@ -288,12 +288,12 @@ def test_initial_release_version( VersionUpdate( previous=current_version, new=release_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), VersionUpdate( previous=release_version, new=next_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), ] git_instance_mock: MagicMock = git_mock.return_value @@ -316,7 +316,7 @@ def test_initial_release_version( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) git_instance_mock.push.assert_has_calls( @@ -334,12 +334,12 @@ def test_initial_release_version( ) self.assertEqual( - create_release_mock.await_args.args[1:], + create_release_mock.await_args.args[1:], # type: ignore[union-attr] (release_version, "foo", "A Changelog", False), ) git_instance_mock.add.assert_has_calls( - [call("MyProject.conf"), call("MyProject.conf")] + [call(Path("MyProject.conf")), call(Path("MyProject.conf"))] ) git_instance_mock.commit.assert_has_calls( [ @@ -392,12 +392,12 @@ def test_release_patch( VersionUpdate( previous=current_version, new=release_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), VersionUpdate( previous=release_version, new=next_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), ] git_instance_mock: MagicMock = git_mock.return_value @@ -422,7 +422,7 @@ def test_release_patch( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) git_instance_mock.push.assert_has_calls( @@ -439,12 +439,12 @@ def test_release_patch( ) self.assertEqual( - create_release_mock.await_args.args[1:], + create_release_mock.await_args.args[1:], # type: ignore[union-attr] (release_version, "foo", "A Changelog", False), ) git_instance_mock.add.assert_has_calls( - [call("MyProject.conf"), call("MyProject.conf")] + [call(Path("MyProject.conf")), call(Path("MyProject.conf"))] ) git_instance_mock.commit.assert_has_calls( [ @@ -498,12 +498,12 @@ def test_release_calendar( VersionUpdate( previous=current_version, new=release_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), VersionUpdate( previous=release_version, new=next_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), ] git_instance_mock: MagicMock = git_mock.return_value @@ -526,7 +526,7 @@ def test_release_calendar( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) git_instance_mock.push.assert_has_calls( @@ -544,12 +544,12 @@ def test_release_calendar( ) self.assertEqual( - create_release_mock.await_args.args[1:], + create_release_mock.await_args.args[1:], # type: ignore[union-attr] (release_version, "foo", "A Changelog", False), ) git_instance_mock.add.assert_has_calls( - [call("MyProject.conf"), call("MyProject.conf")] + [call(Path("MyProject.conf")), call(Path("MyProject.conf"))] ) git_instance_mock.commit.assert_has_calls( [ @@ -604,12 +604,12 @@ def test_release_minor( VersionUpdate( previous=current_version, new=release_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), VersionUpdate( previous=release_version, new=next_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), ] git_instance_mock: MagicMock = git_mock.return_value @@ -634,7 +634,7 @@ def test_release_minor( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) git_instance_mock.push.assert_has_calls( @@ -651,12 +651,12 @@ def test_release_minor( ) self.assertEqual( - create_release_mock.await_args.args[1:], + create_release_mock.await_args.args[1:], # type: ignore[union-attr] (release_version, "foo", "A Changelog", False), ) git_instance_mock.add.assert_has_calls( - [call("MyProject.conf"), call("MyProject.conf")] + [call(Path("MyProject.conf")), call(Path("MyProject.conf"))] ) git_instance_mock.commit.assert_has_calls( [ @@ -709,12 +709,12 @@ def test_release_major( VersionUpdate( previous=current_version, new=release_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), VersionUpdate( previous=release_version, new=next_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), ] git_instance_mock: MagicMock = git_mock.return_value @@ -739,7 +739,7 @@ def test_release_major( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) git_instance_mock.push.assert_has_calls( @@ -756,12 +756,12 @@ def test_release_major( ) self.assertEqual( - create_release_mock.await_args.args[1:], + create_release_mock.await_args.args[1:], # type: ignore[union-attr] (release_version, "foo", "A Changelog", False), ) git_instance_mock.add.assert_has_calls( - [call("MyProject.conf"), call("MyProject.conf")] + [call(Path("MyProject.conf")), call(Path("MyProject.conf"))] ) git_instance_mock.commit.assert_has_calls( [ @@ -814,12 +814,12 @@ def test_release_alpha( VersionUpdate( previous=current_version, new=release_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), VersionUpdate( previous=release_version, new=next_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), ] git_instance_mock: MagicMock = git_mock.return_value @@ -842,7 +842,7 @@ def test_release_alpha( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) git_instance_mock.push.assert_has_calls( @@ -859,12 +859,12 @@ def test_release_alpha( ) self.assertEqual( - create_release_mock.await_args.args[1:], + create_release_mock.await_args.args[1:], # type: ignore[union-attr] (release_version, "foo", "A Changelog", False), ) git_instance_mock.add.assert_has_calls( - [call("MyProject.conf"), call("MyProject.conf")] + [call(Path("MyProject.conf")), call(Path("MyProject.conf"))] ) git_instance_mock.commit.assert_has_calls( [ @@ -919,12 +919,12 @@ def test_release_beta( VersionUpdate( previous=current_version, new=release_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), VersionUpdate( previous=release_version, new=next_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), ] git_instance_mock: MagicMock = git_mock.return_value @@ -947,7 +947,7 @@ def test_release_beta( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) git_instance_mock.push.assert_has_calls( @@ -964,12 +964,12 @@ def test_release_beta( ) self.assertEqual( - create_release_mock.await_args.args[1:], + create_release_mock.await_args.args[1:], # type: ignore[union-attr] (release_version, "foo", "A Changelog", False), ) git_instance_mock.add.assert_has_calls( - [call("MyProject.conf"), call("MyProject.conf")] + [call(Path("MyProject.conf")), call(Path("MyProject.conf"))] ) git_instance_mock.commit.assert_has_calls( [ @@ -1024,12 +1024,12 @@ def test_release_release_candidate( VersionUpdate( previous=current_version, new=release_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), VersionUpdate( previous=release_version, new=next_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), ] git_instance_mock: MagicMock = git_mock.return_value @@ -1052,7 +1052,7 @@ def test_release_release_candidate( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) git_instance_mock.push.assert_has_calls( @@ -1069,12 +1069,12 @@ def test_release_release_candidate( ) self.assertEqual( - create_release_mock.await_args.args[1:], + create_release_mock.await_args.args[1:], # type: ignore[union-attr] (release_version, "foo", "A Changelog", False), ) git_instance_mock.add.assert_has_calls( - [call("MyProject.conf"), call("MyProject.conf")] + [call(Path("MyProject.conf")), call(Path("MyProject.conf"))] ) git_instance_mock.commit.assert_has_calls( [ @@ -1143,7 +1143,7 @@ def test_no_project_settings( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) self.assertEqual( @@ -1194,7 +1194,7 @@ def test_no_update_project( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) git_instance_mock.push.assert_has_calls( @@ -1205,7 +1205,7 @@ def test_no_update_project( ) self.assertEqual( - create_release_mock.await_args.args[1:], + create_release_mock.await_args.args[1:], # type: ignore[union-attr] (release_version, "foo", "A Changelog", False), ) @@ -1261,7 +1261,7 @@ def test_no_last_release_version( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) self.assertEqual( @@ -1299,7 +1299,7 @@ def test_no_release_error( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) self.assertEqual(released, CreateReleaseReturnValue.NO_RELEASE_VERSION) @@ -1329,7 +1329,7 @@ def test_has_tag( released = create_release( terminal=mock_terminal(), error_terminal=mock_terminal(), - token=token, + token=token, # type: ignore[arg-type] args=args, ) @@ -1375,7 +1375,7 @@ def test_update_version_error( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) git_mock.return_value.push.assert_not_called() @@ -1423,12 +1423,12 @@ def test_github_create_release_failure( VersionUpdate( previous=current_version, new=release_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), VersionUpdate( previous=release_version, new=next_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), ] create_changelog_mock.return_value = "A Changelog" @@ -1459,7 +1459,7 @@ def test_github_create_release_failure( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) self.assertEqual( @@ -1469,7 +1469,7 @@ def test_github_create_release_failure( git_instance_mock.push.assert_called_once_with( follow_tags=True, remote=None ) - git_instance_mock.add.assert_called_once_with("MyProject.conf") + git_instance_mock.add.assert_called_once_with(Path("MyProject.conf")) git_instance_mock.commit.assert_called_once_with( "Automatic release to 0.0.1", verify=False, gpg_signing_key="1234" ) @@ -1478,7 +1478,7 @@ def test_github_create_release_failure( ) self.assertEqual( - create_release_mock.await_args.args[1:], + create_release_mock.await_args.args[1:], # type: ignore[union-attr] (release_version, "foo", "A Changelog", False), ) @@ -1512,7 +1512,7 @@ def test_update_version_after_release_error( VersionUpdate( previous=current_version, new=release_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), VersionError("An error"), ] @@ -1538,7 +1538,7 @@ def test_update_version_after_release_error( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) git_instance_mock.push.assert_called_once_with( @@ -1553,11 +1553,11 @@ def test_update_version_after_release_error( ) self.assertEqual( - create_release_mock.await_args.args[1:], + create_release_mock.await_args.args[1:], # type: ignore[union-attr] (release_version, "foo", "A Changelog", False), ) - git_instance_mock.add.assert_called_once_with("MyProject.conf") + git_instance_mock.add.assert_called_once_with(Path("MyProject.conf")) git_instance_mock.commit.assert_called_once_with( "Automatic release to 0.0.1", verify=False, gpg_signing_key="1234" ) @@ -1599,12 +1599,12 @@ def test_release_to_specific_git_remote( VersionUpdate( previous=current_version, new=release_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), VersionUpdate( previous=release_version, new=next_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), ] create_changelog_mock.return_value = "A Changelog" @@ -1634,7 +1634,7 @@ def test_release_to_specific_git_remote( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) git_instance_mock.push.assert_has_calls( @@ -1645,7 +1645,7 @@ def test_release_to_specific_git_remote( ) self.assertEqual( - create_release_mock.await_args.args[1:], + create_release_mock.await_args.args[1:], # type: ignore[union-attr] (release_version, "foo", "A Changelog", False), ) @@ -1656,7 +1656,7 @@ def test_release_to_specific_git_remote( ], ) - git_instance_mock.add.assert_called_with("MyProject.conf") + git_instance_mock.add.assert_called_with(Path("MyProject.conf")) git_instance_mock.commit.assert_called_with( "Automatic adjustments after release\n\n" "* Update to version 0.0.2.dev1\n", @@ -1698,12 +1698,12 @@ def test_release_without_git_prefix( VersionUpdate( previous=current_version, new=release_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), VersionUpdate( previous=release_version, new=next_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), ] create_changelog_mock.return_value = "A Changelog" @@ -1731,7 +1731,7 @@ def test_release_without_git_prefix( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) git_instance_mock.push.assert_has_calls( @@ -1742,7 +1742,7 @@ def test_release_without_git_prefix( ) self.assertEqual( - create_release_mock.await_args.args[1:], + create_release_mock.await_args.args[1:], # type: ignore[union-attr] (release_version, "foo", "A Changelog", False), ) @@ -1753,7 +1753,7 @@ def test_release_without_git_prefix( ], ) - git_instance_mock.add.assert_called_with("MyProject.conf") + git_instance_mock.add.assert_called_with(Path("MyProject.conf")) git_instance_mock.commit.assert_called_with( "Automatic adjustments after release\n\n" "* Update to version 0.0.2.dev1\n", @@ -1792,12 +1792,12 @@ def test_release_github_api( VersionUpdate( previous=current_version, new=release_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), VersionUpdate( previous=release_version, new=next_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), ] create_changelog_mock.return_value = "A Changelog" @@ -1829,7 +1829,7 @@ def test_release_github_api( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) git_instance_mock.push.assert_has_calls( @@ -1854,7 +1854,7 @@ def test_release_github_api( ], ) - git_instance_mock.add.assert_called_with("MyProject.conf") + git_instance_mock.add.assert_called_with(Path("MyProject.conf")) git_instance_mock.commit.assert_called_with( "Automatic adjustments after release\n\n" "* Update to version 0.0.2.dev1\n", @@ -1893,12 +1893,12 @@ def test_release_github_api_pre_release( VersionUpdate( previous=current_version, new=release_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), VersionUpdate( previous=release_version, new=next_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), ] create_changelog_mock.return_value = "A Changelog" @@ -1930,7 +1930,7 @@ def test_release_github_api_pre_release( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) git_instance_mock.push.assert_has_calls( @@ -1955,7 +1955,7 @@ def test_release_github_api_pre_release( ], ) - git_instance_mock.add.assert_called_with("MyProject.conf") + git_instance_mock.add.assert_called_with(Path("MyProject.conf")) git_instance_mock.commit.assert_called_with( "Automatic adjustments after release\n\n" "* Update to version 0.0.1a1+dev1\n", @@ -2001,7 +2001,7 @@ def test_release_with_go_project( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) self.assertEqual(released, CreateReleaseReturnValue.SUCCESS) @@ -2021,7 +2021,7 @@ def test_release_with_go_project( ) self.assertEqual( - create_release_mock.await_args.args[1:], + create_release_mock.await_args.args[1:], # type: ignore[union-attr] (release_version, "foo", "A Changelog", False), ) @@ -2053,12 +2053,12 @@ def test_release_with_changelog( VersionUpdate( previous=current_version, new=release_version, - changed_files=["project.conf"], + changed_files=[Path("project.conf")], ), VersionUpdate( previous=release_version, new=next_version, - changed_files=["project.conf", "version.lang"], + changed_files=[Path("project.conf"), Path("version.lang")], ), ] git_instance_mock: MagicMock = git_mock.return_value @@ -2110,7 +2110,7 @@ def test_release_with_changelog( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) git_instance_mock.list_tags.assert_called_once_with() @@ -2134,7 +2134,7 @@ def test_release_with_changelog( ) self.assertEqual( - create_release_mock.await_args.args[1:], + create_release_mock.await_args.args[1:], # type: ignore[union-attr] (release_version, "foo", expected_changelog, False), ) @@ -2142,7 +2142,11 @@ def test_release_with_changelog( "v0.0.2", gpg_key_id="1234", message="Automatic release to 0.0.2" ) git_instance_mock.add.assert_has_calls( - [call("project.conf"), call("project.conf"), call("version.lang")] + [ + call(Path("project.conf")), + call(Path("project.conf")), + call(Path("version.lang")), + ] ) git_instance_mock.commit.assert_has_calls( [ @@ -2191,12 +2195,12 @@ def test_release_local( VersionUpdate( previous=current_version, new=release_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), VersionUpdate( previous=release_version, new=next_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), ] create_changelog_mock.return_value = "A Changelog" @@ -2223,7 +2227,7 @@ def test_release_local( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) git_instance_mock.push.assert_not_called() @@ -2237,7 +2241,7 @@ def test_release_local( ] ) - git_instance_mock.add.assert_called_with("MyProject.conf") + git_instance_mock.add.assert_called_with(Path("MyProject.conf")) git_instance_mock.commit.assert_called_with( "Automatic adjustments after release\n\n" "* Update to version 0.0.2.dev1\n", @@ -2280,12 +2284,12 @@ def test_release_enforce_github_release( VersionUpdate( previous=current_version, new=release_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), VersionUpdate( previous=release_version, new=next_version, - changed_files=["MyProject.conf"], + changed_files=[Path("MyProject.conf")], ), ] git_instance_mock: MagicMock = git_mock.return_value @@ -2311,7 +2315,7 @@ def test_release_enforce_github_release( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) git_instance_mock.push.assert_has_calls( @@ -2328,12 +2332,12 @@ def test_release_enforce_github_release( ) self.assertEqual( - create_release_mock.await_args.args[1:], + create_release_mock.await_args.args[1:], # type: ignore[union-attr] (release_version, "foo", "A Changelog", True), ) git_instance_mock.add.assert_has_calls( - [call("MyProject.conf"), call("MyProject.conf")] + [call(Path("MyProject.conf")), call(Path("MyProject.conf"))] ) git_instance_mock.commit.assert_has_calls( [ @@ -2360,10 +2364,10 @@ def test_release_enforce_github_release( @dataclass class Release: release_type: str + current_version: str expected_release_version: str - tags: list[str] = field(default_factory=list) + tags: Union[str, list[str]] expected_last_release_version: Optional[str] = None - current_version: Optional[str] = None release_series: Optional[str] = None @@ -2457,7 +2461,7 @@ def test_release( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) self.assertEqual( @@ -2626,7 +2630,7 @@ def test_release_series( terminal=mock_terminal(), error_terminal=mock_terminal(), args=args, - token=token, + token=token, # type: ignore[arg-type] ) self.assertEqual(released, CreateReleaseReturnValue.SUCCESS)