|
1 | 1 | import pytest
|
2 | 2 |
|
3 | | -from commitizen.config import TomlConfig |
| 3 | +from commitizen.config import BaseConfig, TomlConfig |
4 | 4 | from commitizen.cz.customize import CustomizeCommitsCz
|
| 5 | +from commitizen.error_codes import MISSING_CONFIG |
5 | 6 |
|
6 | 7 |
|
7 | 8 | @pytest.fixture(scope="module")
|
@@ -37,6 +38,14 @@ def config():
|
37 | 38 | return TomlConfig(data=toml_str, path="not_exist.toml")
|
38 | 39 |
|
39 | 40 |
|
| 41 | +def test_initialize_cz_customize_failed(): |
| 42 | + with pytest.raises(SystemExit) as excinfo: |
| 43 | + config = BaseConfig() |
| 44 | + _ = CustomizeCommitsCz(config) |
| 45 | + |
| 46 | + assert excinfo.value.code == MISSING_CONFIG |
| 47 | + |
| 48 | + |
40 | 49 | def test_bump_pattern(config):
|
41 | 50 | cz = CustomizeCommitsCz(config)
|
42 | 51 | assert cz.bump_pattern == "^(break|new|fix|hotfix)"
|
|
0 commit comments