-
-
Notifications
You must be signed in to change notification settings - Fork 334
Expand file tree
/
Copy pathconftest.py
More file actions
50 lines (39 loc) · 1.6 KB
/
conftest.py
File metadata and controls
50 lines (39 loc) · 1.6 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from pathlib import Path
import pytest
from pytest_mock import MockerFixture, MockType
from commitizen.config.json_config import JsonConfig
@pytest.fixture
def config_customize() -> JsonConfig:
json_string = r"""{
"commitizen": {
"name": "cz_customize",
"version": "3.0.0",
"changelog_incremental": "true",
"customize": {
"message_template": "{{prefix}}({{scope}}): {{subject}}\n\n{{body}}{% if is_breaking_change %}\nBREAKING CHANGE: {{footer}}{% endif %}",
"schema": "<type>(<scope>): <subject>\n<BLANK LINE>\n<body>\n<BLANK LINE>\n(BREAKING CHANGE: <footer>)",
"schema_pattern": "(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert|bump)(\\(\\S+\\))?!?:(\\s.*)",
"change_type_map": {
"feat": "Feat",
"fix": "Fix",
"refactor": "Refactor",
"perf": "Perf"
},
"change_type_order": ["Refactor", "Feat"],
"commit_parser": "^(?P<change_type>feat|fix|refactor|perf|BREAKING CHANGE)(?:\\((?P<scope>[^()\\r\\n]*)\\)|\\()?(?P<breaking>!)?:\\s(?P<message>.*)?",
"changelog_pattern": "^(BREAKING[\\-\\ ]CHANGE|feat|fix|refactor|perf)(\\(.+\\))?(!)?",
"questions": [
]
}
}
}"""
return JsonConfig(data=json_string, path=Path("not_exist.json"))
@pytest.fixture
def changelog_path() -> Path:
return Path("CHANGELOG.md")
@pytest.fixture
def config_path() -> Path:
return Path("pyproject.toml")
@pytest.fixture
def success_mock(mocker: MockerFixture) -> MockType:
return mocker.patch("commitizen.out.success")