Skip to content

Commit e2e928f

Browse files
authored
Merge branch 'master' into issue-1119
2 parents 4e23d00 + 974de65 commit e2e928f

File tree

9 files changed

+110
-83
lines changed

9 files changed

+110
-83
lines changed

commitizen/changelog_formats/__init__.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
from __future__ import annotations
22

3+
import sys
34
from typing import ClassVar, Protocol
45

5-
import importlib_metadata as metadata
6+
if sys.version_info >= (3, 10):
7+
from importlib import metadata
8+
else:
9+
import importlib_metadata as metadata
610

711
from commitizen.changelog import Metadata
812
from commitizen.config.base_config import BaseConfig

commitizen/cz/__init__.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22

33
import importlib
44
import pkgutil
5+
import sys
56
import warnings
67
from typing import Iterable
78

8-
import importlib_metadata as metadata
9+
if sys.version_info >= (3, 10):
10+
from importlib import metadata
11+
else:
12+
import importlib_metadata as metadata
913

1014
from commitizen.cz.base import BaseCommitizen
1115

commitizen/providers/__init__.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
from __future__ import annotations
22

3+
import sys
34
from typing import cast
45

5-
import importlib_metadata as metadata
6+
if sys.version_info >= (3, 10):
7+
from importlib import metadata
8+
else:
9+
import importlib_metadata as metadata
610

711
from commitizen.config.base_config import BaseConfig
812
from commitizen.exceptions import VersionProviderUnknown

commitizen/version_schemes.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
runtime_checkable,
1616
)
1717

18-
import importlib_metadata as metadata
18+
if sys.version_info >= (3, 10):
19+
from importlib import metadata
20+
else:
21+
import importlib_metadata as metadata
22+
1923
from packaging.version import InvalidVersion # noqa: F401: Rexpose the common exception
2024
from packaging.version import Version as _BaseVersion
2125

poetry.lock

+72-71
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ packaging = ">=19"
4747
tomlkit = ">=0.5.3,<1.0.0"
4848
jinja2 = ">=2.10.3"
4949
pyyaml = ">=3.08"
50-
argcomplete = ">=1.12.1,<3.4"
50+
argcomplete = ">=1.12.1,<3.5"
5151
typing-extensions = { version = "^4.0.1", python = "<3.8" }
5252
charset-normalizer = ">=2.1.0,<4"
5353
# Use the Python 3.11 and 3.12 compatible API: https://github.com/python/importlib_metadata#compatibility
54-
importlib_metadata = { version = ">=4.13,<8"}
54+
importlib_metadata = { version = ">=8.0.0,<9", python = "<3.10"}
5555

5656
[tool.poetry.group.dev.dependencies]
5757
# dev tool
@@ -64,7 +64,7 @@ pytest-regressions = "^2.4.0"
6464
pytest-freezer = "^0.4.6"
6565
pytest-xdist = "^3.1.0"
6666
# linter
67-
ruff = ">=0.1.6,<0.5.0"
67+
ruff = ">=0.5.0,<0.6.0"
6868
pre-commit = ">=2.18,<4.0"
6969
mypy = "^1.4"
7070
types-PyYAML = ">=5.4.3,<7.0.0"

tests/test_cli.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def test_commitizen_excepthook(capsys):
8888
with pytest.raises(SystemExit) as excinfo:
8989
cli.commitizen_excepthook(NotAGitProjectError, NotAGitProjectError(), "")
9090

91-
assert excinfo.type == SystemExit
91+
assert excinfo.type is SystemExit
9292
assert excinfo.value.code == NotAGitProjectError.exit_code
9393

9494

@@ -101,7 +101,7 @@ def test_commitizen_debug_excepthook(capsys):
101101
debug=True,
102102
)
103103

104-
assert excinfo.type == SystemExit
104+
assert excinfo.type is SystemExit
105105
assert excinfo.value.code == NotAGitProjectError.exit_code
106106
assert "NotAGitProjectError" in str(excinfo.traceback[0])
107107

@@ -132,7 +132,7 @@ def test_commitizen_excepthook_no_raises(capsys):
132132
no_raise=[NotAGitProjectError.exit_code],
133133
)
134134

135-
assert excinfo.type == SystemExit
135+
assert excinfo.type is SystemExit
136136
assert excinfo.value.code == 0
137137

138138

tests/test_factory.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import sys
22
from textwrap import dedent
33

4-
import importlib_metadata as metadata
4+
if sys.version_info >= (3, 10):
5+
from importlib import metadata
6+
else:
7+
import importlib_metadata as metadata
8+
59
import pytest
610

711
from commitizen import BaseCommitizen, defaults, factory

tests/test_version_schemes.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
from __future__ import annotations
22

3-
import importlib_metadata as metadata
3+
import sys
4+
5+
if sys.version_info >= (3, 10):
6+
from importlib import metadata
7+
else:
8+
import importlib_metadata as metadata
9+
410
import pytest
511
from pytest_mock import MockerFixture
612

0 commit comments

Comments
 (0)