diff options
author | James R. Barlow <jim@purplerock.ca> | 2019-06-19 17:56:24 -0700 |
---|---|---|
committer | James R. Barlow <jim@purplerock.ca> | 2019-06-19 17:56:24 -0700 |
commit | b194645550fb14f3bd22df73d67a11e474d54659 (patch) | |
tree | 3044d6462c551ce55b05799b02848827946f9e88 /tests | |
parent | fb0971cd81bdc47e7df1c3367148f274d9461eb3 (diff) |
Further fixes for Py3.5
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_image_access.py | 5 | ||||
-rw-r--r-- | tests/test_parsers.py | 2 | ||||
-rw-r--r-- | tests/test_pdf.py | 4 |
3 files changed, 7 insertions, 4 deletions
diff --git a/tests/test_image_access.py b/tests/test_image_access.py index 3edb7cc..d5b44b5 100644 --- a/tests/test_image_access.py +++ b/tests/test_image_access.py @@ -18,7 +18,7 @@ from pikepdf import ( StreamDecodeLevel, parse_content_stream, ) - +from pikepdf._cpphelpers import fspath from pikepdf.models.image import UnsupportedImageTypeError @@ -282,7 +282,8 @@ def test_extract_filepath(congress, outdir): xobj, _pdf = congress pim = PdfImage(xobj) - result = pim.extract_to(fileprefix=(outdir / 'image')) + # fspath is for Python 3.5 + result = pim.extract_to(fileprefix=fspath(outdir / 'image')) assert Path(result).exists() assert (outdir / 'image.jpg').exists() diff --git a/tests/test_parsers.py b/tests/test_parsers.py index a7c3013..f79e8f1 100644 --- a/tests/test_parsers.py +++ b/tests/test_parsers.py @@ -1,5 +1,6 @@ import shutil from subprocess import PIPE, run +import sys import pytest @@ -46,6 +47,7 @@ def test_parser_exception(resources): @pytest.mark.skipif(shutil.which('pdftotext') is None, reason="poppler not installed") +@pytest.mark.skipif(sys.version_info < (3, 6), reason="subprocess.run on 3.5") def test_text_filter(resources, outdir): input_pdf = resources / 'veraPDF test suite 6-2-10-t02-pass-a.pdf' diff --git a/tests/test_pdf.py b/tests/test_pdf.py index 7c993eb..0ac62ea 100644 --- a/tests/test_pdf.py +++ b/tests/test_pdf.py @@ -223,14 +223,14 @@ def test_object_stream_mode_generated(trivial, outdir): fix_metadata_version=True, object_stream_mode=pikepdf.ObjectStreamMode.generate, ) - assert b'/ObjStm' in Path(outdir / '1.pdf').read_bytes() + assert b'/ObjStm' in (outdir / '1.pdf').read_bytes() trivial.save( outdir / '2.pdf', fix_metadata_version=False, object_stream_mode=pikepdf.ObjectStreamMode.generate, ) - assert b'/ObjStm' in Path(outdir / '2.pdf').read_bytes() + assert b'/ObjStm' in (outdir / '2.pdf').read_bytes() def test_with_block(resources): |