Tests: more cleanup

This commit is contained in:
James R. Barlow
2018-03-24 15:35:57 -07:00
parent e48590d66c
commit c138161fae
2 changed files with 5 additions and 15 deletions
+4 -1
View File
@@ -21,6 +21,7 @@ import os
import shutil
import resource
import pytest
import sys
from ocrmypdf.pdfinfo import PdfInfo, Colorspace, Encoding
import PyPDF2 as pypdf
from ocrmypdf.exceptions import ExitCode
@@ -552,7 +553,7 @@ def test_algo4(resources, no_outpdf):
@pytest.mark.parametrize('renderer', [
'hocr']) # tesseract cannot pass this test - resamples to square image
'hocr', 'sandwich']) # tesseract cannot pass this test - resamples to square image
def test_non_square_resolution(renderer, spoof_tesseract_cache,
resources, outpdf):
# Confirm input image is non-square resolution
@@ -656,6 +657,8 @@ def test_stdout(spoof_tesseract_noop, ocrmypdf_exec, resources, outpdf):
assert qpdf.check(output_file, log=None)
@pytest.mark.skipif(sys.version_info[0:3] >= (3, 6, 4),
reason="issue fixed in Python 3.6.4")
def test_closed_streams(spoof_tesseract_noop, ocrmypdf_exec, resources, outpdf):
input_file = str(resources / 'francais.pdf')
output_file = str(outpdf)
+1 -14
View File
@@ -15,22 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
from subprocess import Popen, PIPE, check_output, check_call, DEVNULL
from pathlib import Path
import os
import shutil
import resource
import pytest
from ocrmypdf.pdfinfo import PdfInfo, Colorspace, Encoding
import PyPDF2 as pypdf
from ocrmypdf.exceptions import ExitCode
from ocrmypdf import leptonica
from ocrmypdf.pdfa import file_claims_pdfa
from ocrmypdf.exec import ghostscript, tesseract, qpdf
import logging
from math import isclose
import PIL
# pytest.helpers is dynamic
# pylint: disable=no-member
@@ -46,7 +33,7 @@ spoof = pytest.helpers.spoof
def test_no_unpaper(resources, no_outpdf):
# <disable unpaper here>
p, out, err = run_ocrmypdf(
resources / 'c02-22.pdf', no_outpdf, '--clean', env=env)
resources / 'c02-22.pdf', no_outpdf, '--clean', env=os.environ)
assert p.returncode == ExitCode.missing_dependency