From 86178271df40b73158c41ba2fbc5b9416561a75b Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Mon, 28 Oct 2019 11:47:42 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20dinglehopper:=20Fix=20repeated=20te?= =?UTF-8?q?sts=20for=20the=20OCR-D=20interface?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dinglehopper/tests/test_integ_ocrd_cli.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/qurator/dinglehopper/tests/test_integ_ocrd_cli.py b/qurator/dinglehopper/tests/test_integ_ocrd_cli.py index 36f50b4..75d75ab 100644 --- a/qurator/dinglehopper/tests/test_integ_ocrd_cli.py +++ b/qurator/dinglehopper/tests/test_integ_ocrd_cli.py @@ -1,5 +1,8 @@ import os import re +import shutil +import json +from pathlib import Path from click.testing import CliRunner import pytest @@ -23,8 +26,15 @@ class working_directory: os.chdir(self.wd) -def test_ocrd_cli(): - test_workspace_dir = os.path.join(data_dir, 'actevedef_718448162') +def test_ocrd_cli(tmp_path): + """Test OCR-D interface""" + + # Copy test workspace + test_workspace_dir_source = Path(data_dir) / 'actevedef_718448162' + test_workspace_dir = tmp_path / 'test_ocrd_cli' + shutil.copytree(test_workspace_dir_source, test_workspace_dir) + + # Run through the OCR-D interface with working_directory(test_workspace_dir): runner = CliRunner() result = runner.invoke(ocrd_dinglehopper, [ @@ -33,4 +43,5 @@ def test_ocrd_cli(): '-O', 'OCR-D-OCR-CALAMARI-EVAL' ]) assert result.exit_code == 0 - # XXX Check for useful output, too + result_json = list((Path(test_workspace_dir) / 'OCR-D-OCR-CALAMARI-EVAL').glob('*.json')) + assert json.load(open(result_json[0]))['cer'] < 0.03