Skip to content

Commit

Permalink
Merge branch 'master' into issue-1119
Browse files Browse the repository at this point in the history
  • Loading branch information
paduszyk authored Jul 2, 2024
2 parents 4e23d00 + 974de65 commit e2e928f
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 83 deletions.
6 changes: 5 additions & 1 deletion commitizen/changelog_formats/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
from __future__ import annotations

import sys
from typing import ClassVar, Protocol

import importlib_metadata as metadata
if sys.version_info >= (3, 10):
from importlib import metadata
else:
import importlib_metadata as metadata

from commitizen.changelog import Metadata
from commitizen.config.base_config import BaseConfig
Expand Down
6 changes: 5 additions & 1 deletion commitizen/cz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

import importlib
import pkgutil
import sys
import warnings
from typing import Iterable

import importlib_metadata as metadata
if sys.version_info >= (3, 10):
from importlib import metadata
else:
import importlib_metadata as metadata

from commitizen.cz.base import BaseCommitizen

Expand Down
6 changes: 5 additions & 1 deletion commitizen/providers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
from __future__ import annotations

import sys
from typing import cast

import importlib_metadata as metadata
if sys.version_info >= (3, 10):
from importlib import metadata
else:
import importlib_metadata as metadata

from commitizen.config.base_config import BaseConfig
from commitizen.exceptions import VersionProviderUnknown
Expand Down
6 changes: 5 additions & 1 deletion commitizen/version_schemes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
runtime_checkable,
)

import importlib_metadata as metadata
if sys.version_info >= (3, 10):
from importlib import metadata
else:
import importlib_metadata as metadata

from packaging.version import InvalidVersion # noqa: F401: Rexpose the common exception
from packaging.version import Version as _BaseVersion

Expand Down
143 changes: 72 additions & 71 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ packaging = ">=19"
tomlkit = ">=0.5.3,<1.0.0"
jinja2 = ">=2.10.3"
pyyaml = ">=3.08"
argcomplete = ">=1.12.1,<3.4"
argcomplete = ">=1.12.1,<3.5"
typing-extensions = { version = "^4.0.1", python = "<3.8" }
charset-normalizer = ">=2.1.0,<4"
# Use the Python 3.11 and 3.12 compatible API: https://github.com/python/importlib_metadata#compatibility
importlib_metadata = { version = ">=4.13,<8"}
importlib_metadata = { version = ">=8.0.0,<9", python = "<3.10"}

[tool.poetry.group.dev.dependencies]
# dev tool
Expand All @@ -64,7 +64,7 @@ pytest-regressions = "^2.4.0"
pytest-freezer = "^0.4.6"
pytest-xdist = "^3.1.0"
# linter
ruff = ">=0.1.6,<0.5.0"
ruff = ">=0.5.0,<0.6.0"
pre-commit = ">=2.18,<4.0"
mypy = "^1.4"
types-PyYAML = ">=5.4.3,<7.0.0"
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_commitizen_excepthook(capsys):
with pytest.raises(SystemExit) as excinfo:
cli.commitizen_excepthook(NotAGitProjectError, NotAGitProjectError(), "")

assert excinfo.type == SystemExit
assert excinfo.type is SystemExit
assert excinfo.value.code == NotAGitProjectError.exit_code


Expand All @@ -101,7 +101,7 @@ def test_commitizen_debug_excepthook(capsys):
debug=True,
)

assert excinfo.type == SystemExit
assert excinfo.type is SystemExit
assert excinfo.value.code == NotAGitProjectError.exit_code
assert "NotAGitProjectError" in str(excinfo.traceback[0])

Expand Down Expand Up @@ -132,7 +132,7 @@ def test_commitizen_excepthook_no_raises(capsys):
no_raise=[NotAGitProjectError.exit_code],
)

assert excinfo.type == SystemExit
assert excinfo.type is SystemExit
assert excinfo.value.code == 0


Expand Down
6 changes: 5 additions & 1 deletion tests/test_factory.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import sys
from textwrap import dedent

import importlib_metadata as metadata
if sys.version_info >= (3, 10):
from importlib import metadata
else:
import importlib_metadata as metadata

import pytest

from commitizen import BaseCommitizen, defaults, factory
Expand Down
8 changes: 7 additions & 1 deletion tests/test_version_schemes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
from __future__ import annotations

import importlib_metadata as metadata
import sys

if sys.version_info >= (3, 10):
from importlib import metadata
else:
import importlib_metadata as metadata

import pytest
from pytest_mock import MockerFixture

Expand Down

0 comments on commit e2e928f

Please sign in to comment.