From 00dec7a2f3e004d486a8098cea8ac043ccb0d545 Mon Sep 17 00:00:00 2001 From: Cesar Berrospi Ramis <75900930+ceberam@users.noreply.github.com> Date: Tue, 17 Dec 2024 16:35:42 +0100 Subject: [PATCH] test: generate file from CLI in a temporary directory (#618) Signed-off-by: Cesar Berrospi Ramis <75900930+ceberam@users.noreply.github.com> --- tests/test_cli.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index 48f863a6..71d14457 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,3 +1,5 @@ +from pathlib import Path + from typer.testing import CliRunner from docling.cli.main import app @@ -15,6 +17,11 @@ def test_cli_version(): assert result.exit_code == 0 -def test_cli_convert(): - result = runner.invoke(app, ["./tests/data/2305.03393v1-pg9.pdf"]) +def test_cli_convert(tmp_path): + source = "./tests/data/2305.03393v1-pg9.pdf" + output = tmp_path / "out" + output.mkdir() + result = runner.invoke(app, [source, "--output", str(output)]) assert result.exit_code == 0 + converted = output / f"{Path(source).stem}.md" + assert converted.exists()