tests: fix problems with ghostscript spoofers

This commit is contained in:
James R. Barlow
2019-12-31 15:33:03 -08:00
parent 25d2b0cda4
commit 4b759af6ff
3 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -35,13 +35,13 @@ def main():
print('SPOOFED: ' + os.path.basename(__file__))
sys.exit(0)
# For any rendering calls (device == pdfwrite) call real ghostscript
if '-sDEVICE=pdfwrite' in sys.argv:
# For non-image rastering calls, use real ghostscript
if '-sDEVICE=pdfwrite' in sys.argv or '-sDEVICE=txtwrite' in sys.argv:
real_ghostscript(sys.argv)
return
# Fail
print("ERROR: Ghost story archive not found")
print("ERROR: Ghost story archive not found", file=sys.stderr)
sys.exit(1)
+1 -1
View File
@@ -40,7 +40,7 @@ def main():
return
# Fail
print("ERROR: Casper is not a friendly ghost")
print("ERROR: Casper is not a friendly ghost", file=sys.stderr)
sys.exit(1)
+2 -2
View File
@@ -119,7 +119,7 @@ def test_gs_render_failure(spoof_no_tess_gs_render_fail, resources, outpdf):
p, out, err = run_ocrmypdf(
resources / 'blank.pdf', outpdf, env=spoof_no_tess_gs_render_fail
)
print(err)
assert 'Casper is not a friendly ghost' in err
assert p.returncode == ExitCode.child_process_error
@@ -127,7 +127,7 @@ def test_gs_raster_failure(spoof_no_tess_gs_raster_fail, resources, outpdf):
p, out, err = run_ocrmypdf(
resources / 'ccitt.pdf', outpdf, env=spoof_no_tess_gs_raster_fail
)
print(err)
assert 'Ghost story archive not found' in err
assert p.returncode == ExitCode.child_process_error