Skip to content

Commit

Permalink
isinstance(_patch_version, str)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcinKonowalczyk committed Apr 27, 2024
1 parent 9ffd88e commit be21104
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/test_provision.py
Expand Up @@ -62,11 +62,12 @@ def _make_tox_wheel(
into = tmp_path_factory.mktemp("dist") # pragma: no cover
from tox.version import version_tuple # noqa: PLC0415

if version_tuple[2][:3] == "dev":
_patch_version = version_tuple[2]
if isinstance(_patch_version, str) and _patch_version[:3] == "dev":
# Version is in the form of 1.23.dev456, we need to increment the 456 part
version = f"{version_tuple[0]}.{version_tuple[1]}.dev{int(version_tuple[2][3:]) + 1}"
version = f"{version_tuple[0]}.{version_tuple[1]}.dev{int(_patch_version[3:]) + 1}"
else:
version = f"{version_tuple[0]}.{version_tuple[1]}.{int(version_tuple[2]) + 1}"
version = f"{version_tuple[0]}.{version_tuple[1]}.{int(_patch_version) + 1}"

with mock.patch.dict(os.environ, {"SETUPTOOLS_SCM_PRETEND_VERSION": version}):
return pkg_builder(into, Path(__file__).parents[1], ["wheel"], False) # pragma: no cover
Expand Down

0 comments on commit be21104

Please sign in to comment.