diff options
author | James R. Barlow <jim@purplerock.ca> | 2019-02-10 22:11:19 -0800 |
---|---|---|
committer | James R. Barlow <jim@purplerock.ca> | 2019-02-10 22:11:19 -0800 |
commit | 9fdd79a02db93209d654be2ea96c57a86171e414 (patch) | |
tree | 0c95077f50ad2fa7c156c7a3779b433fa5b4888b /tests | |
parent | 2cfe38690ac22f140be00973292d9cfb4f320361 (diff) |
pylint: big cleanup
Diffstat (limited to 'tests')
-rw-r--r-- | tests/conftest.py | 2 | ||||
-rw-r--r-- | tests/test_dictionary.py | 3 | ||||
-rw-r--r-- | tests/test_image_access.py | 9 | ||||
-rw-r--r-- | tests/test_metadata.py | 2 | ||||
-rw-r--r-- | tests/test_object.py | 2 | ||||
-rw-r--r-- | tests/test_pages.py | 3 | ||||
-rw-r--r-- | tests/test_parsers.py | 1 | ||||
-rw-r--r-- | tests/test_pdf.py | 7 | ||||
-rw-r--r-- | tests/test_private_pdfs.py | 8 | ||||
-rw-r--r-- | tests/test_refcount.py | 1 | ||||
-rw-r--r-- | tests/test_sanity.py | 1 |
11 files changed, 22 insertions, 17 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index 1b4747e..683e71a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,8 +1,6 @@ import os -import platform import sys from pathlib import Path -from subprocess import PIPE, Popen import pytest diff --git a/tests/test_dictionary.py b/tests/test_dictionary.py index ffaf94f..78a558a 100644 --- a/tests/test_dictionary.py +++ b/tests/test_dictionary.py @@ -3,6 +3,9 @@ import pytest from pikepdf import Pdf +# pylint: disable=redefined-outer-name,pointless-statement,expression-not-assigned + + @pytest.fixture def congress(resources): pdf = Pdf.open(resources / 'congress.pdf') diff --git a/tests/test_image_access.py b/tests/test_image_access.py index 65a7992..8a41dbf 100644 --- a/tests/test_image_access.py +++ b/tests/test_image_access.py @@ -17,6 +17,9 @@ from pikepdf import ( ) +# pylint: disable=redefined-outer-name + + def first_image_in(filename): pdf = Pdf.open(filename) pdfimagexobj = next(iter(pdf.pages[0].images.values())) @@ -197,8 +200,8 @@ def test_image_roundtrip(outdir, w, h, pixeldata, cs, bpc): ('cmyk-jpeg.pdf', 8, ['/DCTDecode'], '.jpg', 'CMYK', 'JPEG'), ], ) -def test_direct_extract(resources, filename, bpc, filters, ext, mode, format): - xobj, pdf = first_image_in(resources / filename) +def test_direct_extract(resources, filename, bpc, filters, ext, mode, format_): + xobj, _pdf = first_image_in(resources / filename) pim = PdfImage(xobj) assert pim.bits_per_component == bpc @@ -211,7 +214,7 @@ def test_direct_extract(resources, filename, bpc, filters, ext, mode, format): im = Image.open(outstream) assert im.mode == mode - assert im.format == format + assert im.format == format_ @pytest.mark.parametrize( diff --git a/tests/test_metadata.py b/tests/test_metadata.py index b0e8345..a359938 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -25,7 +25,7 @@ except ImportError: pytestmark = pytest.mark.filterwarnings('ignore:.*XMLParser.*:DeprecationWarning') -# pylint: disable=w0621 +# pylint: disable=redefined-outer-name,pointless-statement @pytest.fixture diff --git a/tests/test_object.py b/tests/test_object.py index f2725f2..9f1e728 100644 --- a/tests/test_object.py +++ b/tests/test_object.py @@ -124,7 +124,7 @@ def test_nested_list2(array): def test_list_apis(): a = pikepdf.Array([1, 2, 3]) - a[1] = None + a[1] = None # pylint: disable=unsupported-assignment-operation assert a[1] is None assert len(a) == 3 del a[1] diff --git a/tests/test_pages.py b/tests/test_pages.py index 2dd3783..75328d8 100644 --- a/tests/test_pages.py +++ b/tests/test_pages.py @@ -8,6 +8,9 @@ import pytest from pikepdf import Pdf, PdfMatrix, Stream +# pylint: disable=redefined-outer-name,pointless-statement + + @pytest.fixture def graph(resources): return Pdf.open(resources / 'graph.pdf') diff --git a/tests/test_parsers.py b/tests/test_parsers.py index 0ed400b..a7c3013 100644 --- a/tests/test_parsers.py +++ b/tests/test_parsers.py @@ -1,5 +1,4 @@ import shutil -import sys from subprocess import PIPE, run import pytest diff --git a/tests/test_pdf.py b/tests/test_pdf.py index e561ebe..e4d0e45 100644 --- a/tests/test_pdf.py +++ b/tests/test_pdf.py @@ -15,6 +15,9 @@ from pikepdf import PasswordError, Pdf, PdfError, Stream from pikepdf._cpphelpers import fspath # For py35 +# pylint: disable=redefined-outer-name + + @pytest.fixture def trivial(resources): return Pdf.open(resources / 'pal-1bit-trivial.pdf') @@ -153,12 +156,12 @@ def test_fileno_fails(resources): with patch('os.dup') as dup: dup.side_effect = OSError('assume dup fails') with pytest.raises(OSError): - pdf = Pdf.open(resources / 'pal-1bit-trivial.pdf') + Pdf.open(resources / 'pal-1bit-trivial.pdf') with patch('os.dup') as dup: dup.return_value = -1 with pytest.raises(RuntimeError): - pdf = Pdf.open(resources / 'pal-1bit-trivial.pdf') + Pdf.open(resources / 'pal-1bit-trivial.pdf') def test_min_and_force_version(trivial, outdir): diff --git a/tests/test_private_pdfs.py b/tests/test_private_pdfs.py index 410f698..25fdff9 100644 --- a/tests/test_private_pdfs.py +++ b/tests/test_private_pdfs.py @@ -1,15 +1,13 @@ import gzip -import os -import platform -import shutil -from contextlib import suppress from pathlib import Path -from shutil import copy import pytest from pikepdf import Pdf, PdfError +# pylint: disable=redefined-outer-name + + # Files with unknown copyright status can't be shared publicly PRIVATE_RESOURCES = Path(__file__).parent / 'resources' / 'private' diff --git a/tests/test_refcount.py b/tests/test_refcount.py index 0cbe01b..7d3f66a 100644 --- a/tests/test_refcount.py +++ b/tests/test_refcount.py @@ -1,5 +1,4 @@ import gc -import sys from sys import getrefcount as refcount import pytest diff --git a/tests/test_sanity.py b/tests/test_sanity.py index a4f72b0..e63c99e 100644 --- a/tests/test_sanity.py +++ b/tests/test_sanity.py @@ -3,7 +3,6 @@ A bunch of quick tests that confirm nothing is horribly wrong """ import gc -import sys from contextlib import suppress from shutil import copy |