MCPcopy Index your code
hub / github.com/commitizen-tools/commitizen / test_uv_provider

Function test_uv_provider

tests/providers/test_uv_provider.py:88–121  ·  view source on GitHub ↗
(
    config: BaseConfig,
    tmp_path,
    monkeypatch,
    file_regression: FileRegressionFixture,
    pyproject_content: str,
)

Source from the content-addressed store, hash-verified

86 ],
87)
88def test_uv_provider(
89 config: BaseConfig,
90 tmp_path,
91 monkeypatch,
92 file_regression: FileRegressionFixture,
93 pyproject_content: str,
94):
95 monkeypatch.chdir(tmp_path)
96 pyproject_toml_file = tmp_path / UvProvider.filename
97 pyproject_toml_file.write_text(pyproject_content, encoding="utf-8")
98
99 uv_lock_file = tmp_path / UvProvider.lock_filename
100 uv_lock_file.write_text(UV_LOCK_SIMPLIFIED, encoding="utf-8")
101
102 config.settings["version_provider"] = "uv"
103
104 provider = get_provider(config)
105 assert isinstance(provider, UvProvider)
106 assert provider.get_version() == "4.2.1"
107
108 provider.set_version("100.100.100")
109 assert provider.get_version() == "100.100.100"
110
111 updated_pyproject_toml_content = pyproject_toml_file.read_text(encoding="utf-8")
112 updated_uv_lock_content = uv_lock_file.read_text(encoding="utf-8")
113
114 for content in (updated_pyproject_toml_content, updated_uv_lock_content):
115 # updated project version
116 assert "100.100.100" in content
117 # commitizen version which was the same as project version and should not be affected
118 assert "4.2.1" in content
119
120 file_regression.check(updated_pyproject_toml_content, extension=".toml")
121 file_regression.check(updated_uv_lock_content, extension=".lock")

Callers

nothing calls this directly

Calls 3

get_providerFunction · 0.90
get_versionMethod · 0.45
set_versionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…