Skip to content

Commit 1967c95

Browse files
committed
Fix python boolean bug
1 parent b52964f commit 1967c95

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

template/.devcontainer/postCreateCommand.sh.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
{% if python == 'y' %}
3+
{% if python %}
44
# Install uv
55
curl -LsSf https://astral.sh/uv/install.sh | sh
66

tests/test_template.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
def 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+
3140
def 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

Comments
 (0)