MCPcopy Create free account
hub / github.com/commitizen-tools/commitizen / tmp_commitizen_project_initial

Function tmp_commitizen_project_initial

tests/conftest.py:99–122  ·  view source on GitHub ↗
(
    tmp_git_project: Path, util: UtilFixture, monkeypatch: pytest.MonkeyPatch
)

Source from the content-addressed store, hash-verified

97
98@pytest.fixture
99def tmp_commitizen_project_initial(
100 tmp_git_project: Path, util: UtilFixture, monkeypatch: pytest.MonkeyPatch
101):
102 def _initial(
103 config_extra: str | None = None,
104 version="0.1.0",
105 initial_commit="feat: new user interface",
106 ):
107 monkeypatch.chdir(tmp_git_project)
108 tmp_commitizen_cfg_file = tmp_git_project / "pyproject.toml"
109 tmp_commitizen_cfg_file.write_text(f'[tool.commitizen]\nversion="{version}"\n')
110 tmp_version_file = tmp_git_project / "__version__.py"
111 tmp_version_file.write_text(version)
112 tmp_version_file_string = str(tmp_version_file).replace("\\", "/")
113 with tmp_commitizen_cfg_file.open("a", encoding="utf-8") as f:
114 f.write(f'\nversion_files = ["{tmp_version_file_string}"]\n')
115 if config_extra:
116 with tmp_commitizen_cfg_file.open("a", encoding="utf-8") as f:
117 f.write(config_extra)
118 util.create_file_and_commit(initial_commit)
119
120 return tmp_git_project
121
122 return _initial
123
124
125def _get_gpg_keyid(signer_mail):

Calls

no outgoing calls

Tested by

no test coverage detected