tests: adapt paths

This commit is contained in:
kba 2025-11-13 11:46:31 +01:00
parent ed5b5c13dd
commit 3afbce023d
7 changed files with 19 additions and 19 deletions

View file

@ -83,7 +83,7 @@ smoke-test: tests/resources/kant_aufklaerung_1784_0020.tif
eynollah -m $(CURDIR)/models_eynollah layout -di $(<D) -o $(TMPDIR) eynollah -m $(CURDIR)/models_eynollah layout -di $(<D) -o $(TMPDIR)
test -s $(TMPDIR)/euler_rechenkunst01_1738_0025.xml test -s $(TMPDIR)/euler_rechenkunst01_1738_0025.xml
# mbreorder, directory mode (overwrite): # mbreorder, directory mode (overwrite):
eynollah -m $(CURDIR)/$(SEG_MODELNAME) machine-based-reading-order -di $(<D) -o $(TMPDIR) eynollah -m $(CURDIR)/models_eynollah machine-based-reading-order -di $(<D) -o $(TMPDIR)
fgrep -q http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15 $(TMPDIR)/$(basename $(<F)).xml fgrep -q http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15 $(TMPDIR)/$(basename $(<F)).xml
fgrep -c -e RegionRefIndexed $(TMPDIR)/$(basename $(<F)).xml fgrep -c -e RegionRefIndexed $(TMPDIR)/$(basename $(<F)).xml
# binarize: # binarize:

View file

@ -10,11 +10,11 @@ from PIL import Image
def test_run_eynollah_binarization_filename( def test_run_eynollah_binarization_filename(
tmp_path, tmp_path,
run_eynollah_ok_and_check_logs, run_eynollah_ok_and_check_logs,
tests_dir, resources_dir,
options, options,
): ):
infile = tests_dir.joinpath('resources/2files/kant_aufklaerung_1784_0020.tif') infile = resources_dir + '/2files/kant_aufklaerung_1784_0020.tif'
outfile = tmp_path.joinpath('kant_aufklaerung_1784_0020.png') outfile = tmp_path / 'kant_aufklaerung_1784_0020.png'
run_eynollah_ok_and_check_logs( run_eynollah_ok_and_check_logs(
'binarization', 'binarization',
[ [
@ -42,7 +42,7 @@ def test_run_eynollah_binarization_directory(
run_eynollah_ok_and_check_logs( run_eynollah_ok_and_check_logs(
'binarization', 'binarization',
[ [
'-di', str(resources_dir), '-di', str(resources_dir / '2files'),
'-o', str(outdir), '-o', str(outdir),
], ],
[ [

View file

@ -13,8 +13,8 @@ def test_run_eynollah_enhancement_filename(
run_eynollah_ok_and_check_logs, run_eynollah_ok_and_check_logs,
options, options,
): ):
infile = resources_dir / 'kant_aufklaerung_1784_0020.tif' infile = resources_dir / '2files/kant_aufklaerung_1784_0020.tif'
outfile = tmp_path.joinpath('kant_aufklaerung_1784_0020.png') outfile = tmp_path / 'kant_aufklaerung_1784_0020.png'
run_eynollah_ok_and_check_logs( run_eynollah_ok_and_check_logs(
'enhancement', 'enhancement',
[ [
@ -41,7 +41,7 @@ def test_run_eynollah_enhancement_directory(
run_eynollah_ok_and_check_logs( run_eynollah_ok_and_check_logs(
'enhancement', 'enhancement',
[ [
'-di', str(resources_dir), '-di', str(resources_dir/ '2files'),
'-o', str(outdir), '-o', str(outdir),
], ],
[ [

View file

@ -27,7 +27,7 @@ def test_run_eynollah_layout_filename(
resources_dir, resources_dir,
options, options,
): ):
infile = resources_dir / 'kant_aufklaerung_1784_0020.tif' infile = resources_dir / '2files/kant_aufklaerung_1784_0020.tif'
outfile = tmp_path / 'kant_aufklaerung_1784_0020.xml' outfile = tmp_path / 'kant_aufklaerung_1784_0020.xml'
run_eynollah_ok_and_check_logs( run_eynollah_ok_and_check_logs(
'layout', 'layout',
@ -61,7 +61,7 @@ def test_run_eynollah_layout_filename2(
run_eynollah_ok_and_check_logs, run_eynollah_ok_and_check_logs,
options, options,
): ):
infile = resources_dir / 'euler_rechenkunst01_1738_0025.tif' infile = resources_dir / '2files/euler_rechenkunst01_1738_0025.tif'
outfile = tmp_path / 'euler_rechenkunst01_1738_0025.xml' outfile = tmp_path / 'euler_rechenkunst01_1738_0025.xml'
run_eynollah_ok_and_check_logs( run_eynollah_ok_and_check_logs(
'layout', 'layout',
@ -94,7 +94,7 @@ def test_run_eynollah_layout_directory(
run_eynollah_ok_and_check_logs( run_eynollah_ok_and_check_logs(
'layout', 'layout',
[ [
'-di', str(resources_dir), '-di', str(resources_dir / '2files'),
'-o', str(outdir), '-o', str(outdir),
], ],
[ [

View file

@ -6,8 +6,8 @@ def test_run_eynollah_mbreorder_filename(
resources_dir, resources_dir,
run_eynollah_ok_and_check_logs, run_eynollah_ok_and_check_logs,
): ):
infile = resources_dir / 'kant_aufklaerung_1784_0020.xml' infile = resources_dir / '2files/kant_aufklaerung_1784_0020.xml'
outfile = tmp_path.joinpath('kant_aufklaerung_1784_0020.xml') outfile = tmp_path /'kant_aufklaerung_1784_0020.xml'
run_eynollah_ok_and_check_logs( run_eynollah_ok_and_check_logs(
'machine-based-reading-order', 'machine-based-reading-order',
[ [
@ -36,7 +36,7 @@ def test_run_eynollah_mbreorder_directory(
run_eynollah_ok_and_check_logs( run_eynollah_ok_and_check_logs(
'machine-based-reading-order', 'machine-based-reading-order',
[ [
'-di', str(resources_dir), '-di', str(resources_dir / '2files'),
'-o', str(outdir), '-o', str(outdir),
], ],
[ [

View file

@ -16,8 +16,8 @@ def test_run_eynollah_ocr_filename(
resources_dir, resources_dir,
options, options,
): ):
infile = resources_dir / 'kant_aufklaerung_1784_0020.tif' infile = resources_dir / '2files/kant_aufklaerung_1784_0020.tif'
outfile = tmp_path.joinpath('kant_aufklaerung_1784_0020.xml') outfile = tmp_path / 'kant_aufklaerung_1784_0020.xml'
outrenderfile = tmp_path / 'render' / 'kant_aufklaerung_1784_0020.png' outrenderfile = tmp_path / 'render' / 'kant_aufklaerung_1784_0020.png'
outrenderfile.parent.mkdir() outrenderfile.parent.mkdir()
if "-doit" in options: if "-doit" in options:
@ -52,8 +52,8 @@ def test_run_eynollah_ocr_directory(
run_eynollah_ok_and_check_logs( run_eynollah_ok_and_check_logs(
'ocr', 'ocr',
[ [
'-di', str(resources_dir), '-di', str(resources_dir / '2files'),
'-dx', str(resources_dir), '-dx', str(resources_dir / '2files'),
'-o', str(outdir), '-o', str(outdir),
], ],
[ [

View file

@ -14,7 +14,7 @@ def model_dir(tests_dir):
@pytest.fixture() @pytest.fixture()
def resources_dir(tests_dir): def resources_dir(tests_dir):
return tests_dir / 'resources/2files' return tests_dir / 'resources'
@pytest.fixture() @pytest.fixture()
def image_resources(resources_dir): def image_resources(resources_dir):