def test_clean(runner: CliRunner): with runner.isolated_filesystem() as path: path = Path(path) / "dist" path.mkdir() result = runner.invoke(app, "clean") assert result.exit_code == 0 assert not path.exists()
def isolated_cli_runner(cli_runner: CliRunner) -> Iterator[CliRunner]: """Instance of `typer.testing.CliRunner` running under a temporary working directory for isolated filesystem tests.""" with cli_runner.isolated_filesystem(): yield cli_runner
def test_build(runner: CliRunner): with runner.isolated_filesystem() as path: result = runner.invoke(app, "build") assert result.exit_code == 0 index = Path(path) / "dist" / "index.html" assert index.exists()
def test_version(runner: CliRunner): with runner.isolated_filesystem(): result = runner.invoke(app, "version") assert result.exit_code == 0 assert result.stdout == "Version: 0.1.0\n"