Debian Codegraph @

tests/commands/conftest.py

raw
1 from pathlib import Path
2
3 import pytest
4 from pytest_mock import MockerFixture, MockType
5
6 from commitizen.config.json_config import JsonConfig
7
8
9 @pytest.fixture
10 def config_customize() -> JsonConfig:
11 json_string = r"""{
12 "commitizen": {
13 "name": "cz_customize",
14 "version": "3.0.0",
15 "changelog_incremental": "true",
16 "customize": {
17 "message_template": "{{prefix}}({{scope}}): {{subject}}\n\n{{body}}{% if is_breaking_change %}\nBREAKING CHANGE: {{footer}}{% endif %}",
18 "schema": "<type>(<scope>): <subject>\n<BLANK LINE>\n<body>\n<BLANK LINE>\n(BREAKING CHANGE: <footer>)",
19 "schema_pattern": "(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert|bump)(\\(\\S+\\))?!?:(\\s.*)",
20 "change_type_map": {
21 "feat": "Feat",
22 "fix": "Fix",
23 "refactor": "Refactor",
24 "perf": "Perf"
25 },
26 "change_type_order": ["Refactor", "Feat"],
27 "commit_parser": "^(?P<change_type>feat|fix|refactor|perf|BREAKING CHANGE)(?:\\((?P<scope>[^()\\r\\n]*)\\)|\\()?(?P<breaking>!)?:\\s(?P<message>.*)?",
28 "changelog_pattern": "^(BREAKING[\\-\\ ]CHANGE|feat|fix|refactor|perf)(\\(.+\\))?(!)?",
29 "questions": [
30
31 ]
32 }
33 }
34 }"""
35 return JsonConfig(data=json_string, path=Path("not_exist.json"))
36
37
38 @pytest.fixture
39 def changelog_path() -> Path:
40 return Path("CHANGELOG.md")
41
42
43 @pytest.fixture
44 def config_path() -> Path:
45 return Path("pyproject.toml")
46
47
48 @pytest.fixture
49 def success_mock(mocker: MockerFixture) -> MockType:
50 return mocker.patch("commitizen.out.success")