1+ import subprocess
12from typing import Any
23
34import pytest
@@ -38,16 +39,27 @@ def test_generate_new_project(tmp_path, generated_project_path):
3839 assert generated_project_path == tmp_path / PROJECT_NAME
3940
4041
41- def test_poetry_uses_dev_group (generated_project_path ):
42+ def test_uses_hatchling_build_system (generated_project_path ):
4243 pyproject_toml_content = generated_project_path .joinpath (
4344 "pyproject.toml"
4445 ).read_text ()
4546
46- assert "dev-dependencies" not in pyproject_toml_content
47- assert "[tool.poetry.group.dev.dependencies]" in pyproject_toml_content .splitlines ()
47+ assert '[build-system]' in pyproject_toml_content
48+ assert 'hatchling' in pyproject_toml_content
49+ assert 'poetry' not in pyproject_toml_content
4850
4951
50- def test_python_version_is_correctly_included_in_black_config (generated_project_path ):
52+ def test_uses_dependency_groups (generated_project_path ):
53+ pyproject_toml_content = generated_project_path .joinpath (
54+ "pyproject.toml"
55+ ).read_text ()
56+
57+ assert '[dependency-groups]' in pyproject_toml_content
58+ assert 'pyrefly' in pyproject_toml_content
59+ assert 'prek' in pyproject_toml_content
60+
61+
62+ def test_python_version_is_correctly_included_in_ruff_config (generated_project_path ):
5163 parsed_pyproject_toml = toml .loads (
5264 generated_project_path .joinpath ("pyproject.toml" ).read_text ()
5365 )
@@ -65,7 +77,7 @@ def test_python_version_is_correctly_included_in_github_workflow(
6577
6678 assert parsed_github_workflow ["jobs" ]["test" ]["strategy" ]["matrix" ][
6779 "python-version"
68- ] == ["3.9" , "3.10" , "3.11" , "3.12" , "3.13" ]
80+ ] == ["3.9" , "3.10" , "3.11" , "3.12" , "3.13" , "3.14" ]
6981
7082
7183def test_specific_files_and_packages_are_not_include_if_package_is_meant_to_be_not_releasable (tmp_path ):
@@ -77,5 +89,40 @@ def test_specific_files_and_packages_are_not_include_if_package_is_meant_to_be_n
7789 parsed_pyproject_toml = toml .loads (
7890 project_path .joinpath ("pyproject.toml" ).read_text ()
7991 )
80- assert "python-kacl" not in parsed_pyproject_toml ["tool" ]["poetry" ]["group" ]["dev" ]["dependencies" ]
92+ dev_deps = parsed_pyproject_toml .get ("dependency-groups" , {}).get ("dev" , [])
93+ assert "python-kacl" not in dev_deps
8194 assert "pypi" not in Path (project_path / "README.md" ).read_text ().lower ()
95+
96+
97+ def test_dependencies_can_be_installed (generated_project_path ):
98+ """Verify that all dependencies in the generated project can be installed with uv sync."""
99+ result = subprocess .run (
100+ ["uv" , "sync" ],
101+ cwd = generated_project_path ,
102+ capture_output = True ,
103+ text = True ,
104+ )
105+ assert result .returncode == 0 , f"uv sync failed: { result .stderr } "
106+
107+
108+ def test_precommit_hooks_pass (generated_project_path ):
109+ """Verify that all pre-commit hooks pass on the generated project."""
110+ subprocess .run (
111+ ["git" , "init" ],
112+ cwd = generated_project_path ,
113+ capture_output = True ,
114+ text = True ,
115+ )
116+ subprocess .run (
117+ ["git" , "add" , "." ],
118+ cwd = generated_project_path ,
119+ capture_output = True ,
120+ text = True ,
121+ )
122+ result = subprocess .run (
123+ ["uv" , "run" , "prek" , "run" , "--all-files" ],
124+ cwd = generated_project_path ,
125+ capture_output = True ,
126+ text = True ,
127+ )
128+ assert result .returncode == 0 , f"prek run failed:\n stdout: { result .stdout } \n stderr: { result .stderr } "
0 commit comments