-
-
Notifications
You must be signed in to change notification settings - Fork 334
Expand file tree
/
Copy pathtest_deprecated.py
More file actions
35 lines (30 loc) · 1.64 KB
/
test_deprecated.py
File metadata and controls
35 lines (30 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pytest
from commitizen import changelog_formats, defaults
def test_getattr_deprecated_vars():
# Test each deprecated variable
with pytest.warns(DeprecationWarning, match="is deprecated and will be removed"):
assert defaults.bump_pattern == defaults.BUMP_PATTERN
with pytest.warns(DeprecationWarning, match="is deprecated and will be removed"):
assert defaults.bump_map == defaults.BUMP_MAP
with pytest.warns(DeprecationWarning, match="is deprecated and will be removed"):
assert (
defaults.bump_map_major_version_zero == defaults.BUMP_MAP_MAJOR_VERSION_ZERO
)
with pytest.warns(DeprecationWarning, match="is deprecated and will be removed"):
assert defaults.bump_message == defaults.BUMP_MESSAGE
with pytest.warns(DeprecationWarning, match="is deprecated and will be removed"):
assert defaults.change_type_order == defaults.CHANGE_TYPE_ORDER
with pytest.warns(DeprecationWarning, match="is deprecated and will be removed"):
assert defaults.encoding == defaults.ENCODING
with pytest.warns(DeprecationWarning, match="is deprecated and will be removed"):
assert defaults.name == defaults.DEFAULT_SETTINGS["name"]
with pytest.warns(DeprecationWarning, match="is deprecated and will be removed"):
assert (
changelog_formats._guess_changelog_format
== changelog_formats.guess_changelog_format
)
def test_getattr_non_existent():
# Test non-existent attribute
with pytest.raises(AttributeError) as exc_info:
_ = defaults.non_existent_attribute
assert "is not an attribute of" in str(exc_info.value)