copier/tests/test_cli.py
Jairo Llopis 823f3a1935 Remove dst fixture
This is redundant with pytest's native `tmp_path` fixture, so we use that one instead now.
2020-06-23 07:58:03 +00:00

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")