66
77def run_copier (template_dir : Path , dest : Path , data : dict [str , str ]) -> subprocess .CompletedProcess :
88 args = [
9+ "uvx" ,
910 "copier" ,
1011 "copy" ,
1112 "--defaults" ,
@@ -28,6 +29,14 @@ def assert_missing(base: Path, *paths: str) -> None:
2829 assert not (base / p ).exists (), f"Expected missing: { p } "
2930
3031
32+ def assert_file_contains (base : Path , file_path : str , expected_content : str ) -> None :
33+ """Assert that a file contains expected content."""
34+ full_path = base / file_path
35+ assert full_path .exists (), f"Expected file to exist: { file_path } "
36+ content = full_path .read_text ()
37+ assert expected_content in content , f"Expected '{ expected_content } ' in { file_path } , but got: { content } "
38+
39+
3140def test_python_data_science (tmp_path : Path ) -> None :
3241 dest = tmp_path / "py"
3342 res = run_copier (
@@ -140,3 +149,7 @@ def test_python_mkdocs_only(tmp_path: Path) -> None:
140149 dest , "docs" , "mkdocs.yml" , "pyproject.toml" , "tox.ini" , "docs_proj" , "tests" , ".github" , ".devcontainer"
141150 )
142151 assert_missing (dest , "notebooks" )
152+ # Check that postCreateCommand.sh contains the expected Python setup commands
153+ assert_file_contains (dest , ".devcontainer/postCreateCommand.sh" , "curl -LsSf https://astral.sh/uv/install.sh | sh" )
154+ assert_file_contains (dest , ".devcontainer/postCreateCommand.sh" , "uv sync --group dev" )
155+ assert_file_contains (dest , ".devcontainer/postCreateCommand.sh" , "uv run pre-commit install --install-hooks" )
0 commit comments