Skip to content

Commit f71b8e1

Browse files
test(cli): smoke and file:// integration scaffold
Closes #40 Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 70739b3 commit f71b8e1

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from pathlib import Path
2+
3+
import pytest
4+
from typer.testing import CliRunner
5+
6+
from create_awesome_python_app.cli import app
7+
8+
runner = CliRunner()
9+
10+
11+
def test_help_smoke() -> None:
12+
assert runner.invoke(app, ["--help"]).exit_code == 0
13+
14+
15+
def test_scaffold_file(
16+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
17+
) -> None:
18+
monkeypatch.setenv("CPA_SKIP_GIT", "1")
19+
monkeypatch.setenv("CI", "1")
20+
tpl = tmp_path / "tpl"
21+
(tpl / "template").mkdir(parents=True)
22+
(tpl / "template" / "a.txt").write_text("a")
23+
dest = tmp_path / "app"
24+
# Options must come before the project_directory argument (Typer parsing).
25+
result = runner.invoke(
26+
app,
27+
[
28+
"--template",
29+
f"file://{tpl}",
30+
"--no-install",
31+
"--no-interactive",
32+
str(dest),
33+
],
34+
)
35+
assert result.exit_code == 0, result.stdout + result.stderr
36+
assert (dest / "a.txt").read_text() == "a"

0 commit comments

Comments
 (0)