Skip to content

Commit 4f0e55d

Browse files
committed
updated hooks and tests to validate version.py is removed when using uv
1 parent ec17f13 commit 4f0e55d

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

hooks/post_gen_project.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
'{% if cookiecutter.package_manager == "uv" %}requirements-dev.txt{% endif %}',
2626
'{% if cookiecutter.package_manager == "uv" %}.github/workflows/publish-to-pypi.yml{% endif %}',
2727
'{% if cookiecutter.package_manager == "uv" %}.github/workflows/test-coverage-lint.yml{% endif %}',
28+
'{% if cookiecutter.package_manager == "uv" %}{{cookiecutter.__app_name}}/version.py{% endif %}',
2829
]
2930

3031
REMOVE_PATHS_PIP = [

tests/test_cookies.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def test_bake_project_api_only_podman(cookies, bake_project_api_only_podman):
1919
assert result.project_path.joinpath(".github", "workflows", "test-coverage-lint.yml").is_file()
2020
assert not result.project_path.joinpath(".github", "workflows", "publish-to-pypi-uv.yml").is_file()
2121
assert not result.project_path.joinpath(".github", "workflows", "test-coverage-lint-uv.yml").is_file()
22+
assert result.project_path.joinpath("api_only", "version.py").is_file()
2223

2324

2425
def test_bake_project_uv_api_only_podman(cookies, bake_project_uv_api_only_podman):
@@ -42,6 +43,7 @@ def test_bake_project_uv_api_only_podman(cookies, bake_project_uv_api_only_podma
4243
assert not result.project_path.joinpath(".github", "workflows", "test-coverage-lint.yml").is_file()
4344
assert result.project_path.joinpath(".github", "workflows", "publish-to-pypi-uv.yml").is_file()
4445
assert result.project_path.joinpath(".github", "workflows", "test-coverage-lint-uv.yml").is_file()
46+
assert not result.project_path.joinpath("api_only", "version.py").is_file()
4547

4648

4749
def test_bake_project_api_only_docker(cookies, bake_project_api_only_docker):
@@ -65,6 +67,7 @@ def test_bake_project_api_only_docker(cookies, bake_project_api_only_docker):
6567
assert result.project_path.joinpath(".github", "workflows", "test-coverage-lint.yml").is_file()
6668
assert not result.project_path.joinpath(".github", "workflows", "publish-to-pypi-uv.yml").is_file()
6769
assert not result.project_path.joinpath(".github", "workflows", "test-coverage-lint-uv.yml").is_file()
70+
assert result.project_path.joinpath("api_only", "version.py").is_file()
6871

6972

7073
def test_bake_project_uv_api_only_docker(cookies, bake_project_uv_api_only_docker):
@@ -88,6 +91,7 @@ def test_bake_project_uv_api_only_docker(cookies, bake_project_uv_api_only_docke
8891
assert not result.project_path.joinpath(".github", "workflows", "test-coverage-lint.yml").is_file()
8992
assert result.project_path.joinpath(".github", "workflows", "publish-to-pypi-uv.yml").is_file()
9093
assert result.project_path.joinpath(".github", "workflows", "test-coverage-lint-uv.yml").is_file()
94+
assert not result.project_path.joinpath("api_only", "version.py").is_file()
9195

9296

9397
def test_bake_project_api_with_webpages_podman(cookies, bake_project_api_with_webpages_podman):
@@ -111,6 +115,7 @@ def test_bake_project_api_with_webpages_podman(cookies, bake_project_api_with_we
111115
assert result.project_path.joinpath(".github", "workflows", "test-coverage-lint.yml").is_file()
112116
assert not result.project_path.joinpath(".github", "workflows", "publish-to-pypi-uv.yml").is_file()
113117
assert not result.project_path.joinpath(".github", "workflows", "test-coverage-lint-uv.yml").is_file()
118+
assert result.project_path.joinpath("api_with_webpages", "version.py").is_file()
114119

115120

116121
def test_bake_project_uv_api_with_webpages_podman(cookies, bake_project_uv_api_with_webpages_podman):
@@ -134,6 +139,7 @@ def test_bake_project_uv_api_with_webpages_podman(cookies, bake_project_uv_api_w
134139
assert not result.project_path.joinpath(".github", "workflows", "test-coverage-lint.yml").is_file()
135140
assert result.project_path.joinpath(".github", "workflows", "publish-to-pypi-uv.yml").is_file()
136141
assert result.project_path.joinpath(".github", "workflows", "test-coverage-lint-uv.yml").is_file()
142+
assert not result.project_path.joinpath("api_with_webpages", "version.py").is_file()
137143

138144

139145
def test_bake_project_api_with_webpages_docker(cookies, bake_project_api_with_webpages_docker):
@@ -157,6 +163,7 @@ def test_bake_project_api_with_webpages_docker(cookies, bake_project_api_with_we
157163
assert result.project_path.joinpath(".github", "workflows", "test-coverage-lint.yml").is_file()
158164
assert not result.project_path.joinpath(".github", "workflows", "publish-to-pypi-uv.yml").is_file()
159165
assert not result.project_path.joinpath(".github", "workflows", "test-coverage-lint-uv.yml").is_file()
166+
assert result.project_path.joinpath("api_with_webpages", "version.py").is_file()
160167

161168

162169
def test_bake_project_uv_api_with_webpages_docker(cookies, bake_project_uv_api_with_webpages_docker):
@@ -180,3 +187,4 @@ def test_bake_project_uv_api_with_webpages_docker(cookies, bake_project_uv_api_w
180187
assert not result.project_path.joinpath(".github", "workflows", "test-coverage-lint.yml").is_file()
181188
assert result.project_path.joinpath(".github", "workflows", "publish-to-pypi-uv.yml").is_file()
182189
assert result.project_path.joinpath(".github", "workflows", "test-coverage-lint-uv.yml").is_file()
190+
assert not result.project_path.joinpath("api_with_webpages", "version.py").is_file()

0 commit comments

Comments
 (0)