Skip to content

Commit ee24a3e

Browse files
committed
tests.processor: check profile log
1 parent 7bc2f4c commit ee24a3e

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/processor/test_processor.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,15 @@ def test_params_missing_required(self):
168168
run_processor(DummyProcessorWithRequiredParameters,
169169
workspace=self.workspace, input_file_grp="OCR-D-IMG")
170170
proc.parameter = {'i-am-required': 'foo'}
171+
proc.input_file_grp = "OCR-D-IMG"
172+
proc.output_file_grp = "OCR-D-OUT"
173+
proc.page_id = []
174+
proc.process_workspace(self.workspace)
175+
run_processor(DummyProcessorWithRequiredParameters,
176+
workspace=self.workspace,
177+
input_file_grp="OCR-D-IMG",
178+
output_file_grp="OCR-D-OUT",
179+
parameter={'i-am-required': 'foo'})
171180

172181
def test_params_preset_resolve(self):
173182
with pushd_popd(tempdir=True) as tempdir:
@@ -433,6 +442,31 @@ def ocrd_tool(self):
433442
r = self.capture_out_err()
434443
assert 'ERROR ocrd.processor.base - Found no file for page phys_0001 in file group GRP1' in r.err
435444

445+
@pytest.fixture
446+
def workspace_sbb():
447+
initLogging()
448+
with copy_of_directory(assets.path_to('SBB0000F29300010000/data')) as workdir:
449+
with pushd_popd(workdir):
450+
resolver = Resolver()
451+
workspace = resolver.workspace_from_url('mets.xml')
452+
yield workspace
453+
disableLogging()
454+
455+
def test_run_output_logging(workspace_sbb, caplog):
456+
caplog.set_level(10)
457+
def only_profile(logrec):
458+
return logrec.name == 'ocrd.process.profile'
459+
with caplog.filtering(only_profile):
460+
proc = run_processor(DummyProcessorWithRequiredParameters,
461+
workspace=workspace_sbb,
462+
input_file_grp="OCR-D-IMG",
463+
output_file_grp="OCR-D-OUT",
464+
parameter={'i-am-required': 'foo'})
465+
assert len(caplog.records) == 1
466+
#assert isinstance(proc.parameter, dict)
467+
msg = caplog.records[0].message
468+
assert msg.startswith("Executing processor 'ocrd-test' took")
469+
436470
def test_run_output_metsserver(start_mets_server):
437471
mets_server_url, ws = start_mets_server
438472
assert len(ws.mets.find_all_files(fileGrp="OCR-D-OUT")) == 0

0 commit comments

Comments
 (0)