-
-
Notifications
You must be signed in to change notification settings - Fork 334
Expand file tree
/
Copy pathtest_deprecated.py
More file actions
33 lines (27 loc) · 1.17 KB
/
test_deprecated.py
File metadata and controls
33 lines (27 loc) · 1.17 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
import pytest
from commitizen import changelog_formats, defaults
def test_getattr_deprecated_vars():
# Test each deprecated variable
with pytest.warns(DeprecationWarning) as record:
assert defaults.bump_pattern == defaults.BUMP_PATTERN
assert defaults.bump_map == defaults.BUMP_MAP
assert (
defaults.bump_map_major_version_zero == defaults.BUMP_MAP_MAJOR_VERSION_ZERO
)
assert defaults.bump_message == defaults.BUMP_MESSAGE
assert defaults.change_type_order == defaults.CHANGE_TYPE_ORDER
assert defaults.encoding == defaults.ENCODING
assert defaults.name == defaults.DEFAULT_SETTINGS["name"]
assert (
changelog_formats._guess_changelog_format
== changelog_formats.guess_changelog_format
)
# Verify warning messages
assert len(record) == 7
for warning in record:
assert "is deprecated and will be removed" in str(warning.message)
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)