Skip to content

Missing pytest.mark.samples #2407

@kitterma

Description

@kitterma

Trying to run the tests when samples are not available

Environment

Which environment were you using when you encountered the problem?

$ python -m platform
Linux-5.10.0-27-amd64-x86_64-with-glibc2.31

$ python -c "import pypdf;print(pypdf._debug_versions)"
pypdf==3.17.4, crypt_provider=('pycryptodome', '3.20.0'), PIL=10.1.0

There are a number of tests that are missing pytest.mark.samples. See the attached patch below

Scott K

diff --git a/tests/test_encryption.py b/tests/test_encryption.py
index cb2d1f7..f15e072 100644
--- a/tests/test_encryption.py
+++ b/tests/test_encryption.py
@@ -344,6 +344,7 @@ def test_aes_decrypt_corrupted_data():
         aes.decrypt(secrets.token_bytes(num))


+@pytest.mark.samples()
 def test_encrypt_stream_dictionary(pdf_file_path):
     user_password = secrets.token_urlsafe(10)

diff --git a/tests/test_images.py b/tests/test_images.py
index 3e9e8a0..b256efe 100644
--- a/tests/test_images.py
+++ b/tests/test_images.py
@@ -73,18 +73,21 @@ def image_similarity(
     return 1 - mse


+@pytest.mark.samples()
 def test_image_similarity_one():
     path_a = SAMPLE_ROOT / "018-base64-image/page-0-QuickPDFImd32aa1ab.png"
     path_b = path_a
     assert image_similarity(path_a, path_b) == 1


+@pytest.mark.samples()
 def test_image_similarity_zero():
     path_a = SAMPLE_ROOT / "018-base64-image/page-0-QuickPDFImd32aa1ab.png"
     path_b = SAMPLE_ROOT / "009-pdflatex-geotopo/page-23-Im2.png"
     assert image_similarity(path_a, path_b) == 0


+@pytest.mark.samples()
 def test_image_similarity_mid():
     path_a = SAMPLE_ROOT / "018-base64-image/page-0-QuickPDFImd32aa1ab.png"
     img_b = Image.open(path_a)
diff --git a/tests/test_reader.py b/tests/test_reader.py
index 555a3b2..d95a6b3 100644
--- a/tests/test_reader.py
+++ b/tests/test_reader.py
@@ -245,6 +245,7 @@ def test_get_images(src, expected_images):
                 pass


+@pytest.mark.samples()
 @pytest.mark.parametrize(
     ("strict", "with_prev_0", "startx_correction", "should_fail", "warning_msgs"),
     [
@@ -672,6 +673,7 @@ def test_reader_properties():
     assert reader.is_encrypted is False


+@pytest.mark.samples()
 @pytest.mark.parametrize(
     "strict",
     [True, False],
diff --git a/tests/test_text_extraction.py b/tests/test_text_extraction.py
index b3e922b..99c3943 100644
--- a/tests/test_text_extraction.py
+++ b/tests/test_text_extraction.py
@@ -19,6 +19,7 @@ RESOURCE_ROOT = PROJECT_ROOT / "resources"
 SAMPLE_ROOT = PROJECT_ROOT / "sample-files"


+@pytest.mark.samples()
 @pytest.mark.parametrize(("visitor_text"), [None, lambda a, b, c, d, e: None])
 def test_multi_language(visitor_text):
     reader = PdfReader(RESOURCE_ROOT / "multilang.pdf")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions