mirror of
https://github.com/copier-org/copier.git
synced 2025-05-05 23:42:55 +00:00
This is redundant with pytest's native `tmp_path` fixture, so we use that one instead now.
27 lines
710 B
Python
27 lines
710 B
Python
from pathlib import Path
|
|
|
|
import yaml
|
|
from plumbum.cmd import copier as copier_cmd
|
|
|
|
from copier.cli import CopierApp
|
|
|
|
SIMPLE_DEMO_PATH = Path(__file__).parent / "demo_simple"
|
|
|
|
|
|
def test_good_cli_run(tmp_path):
|
|
run_result = CopierApp.run(
|
|
["--quiet", "-a", "altered-answers.yml", str(SIMPLE_DEMO_PATH), str(tmp_path)],
|
|
exit=False,
|
|
)
|
|
a_txt = tmp_path / "a.txt"
|
|
assert run_result[1] == 0
|
|
assert a_txt.exists()
|
|
assert a_txt.is_file()
|
|
assert a_txt.read_text().strip() == "EXAMPLE_CONTENT"
|
|
answers = yaml.safe_load((tmp_path / "altered-answers.yml").read_text())
|
|
assert answers["_src_path"] == str(SIMPLE_DEMO_PATH)
|
|
|
|
|
|
def test_help():
|
|
copier_cmd("--help-all")
|