Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing pytest.mark.samples #2407

Closed
kitterma opened this issue Jan 14, 2024 · 3 comments · Fixed by #2412
Closed

Missing pytest.mark.samples #2407

kitterma opened this issue Jan 14, 2024 · 3 comments · Fixed by #2412

Comments

@kitterma
Copy link
Contributor

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))


[email protected]()
 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


[email protected]()
 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


[email protected]()
 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


[email protected]()
 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


[email protected]()
 @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


[email protected]()
 @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"


[email protected]()
 @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")
@stefan6419846
Copy link
Collaborator

Thanks for the report. Do you want to submit a PR as you already have generated a patch anyway?

kitterma pushed a commit to kitterma/pypdf that referenced this issue Jan 15, 2024
@kitterma
Copy link
Contributor Author

Done. #2412

@kitterma
Copy link
Contributor Author

I've gone back and checked and I agree with the ones that you didn't include. Appreciate the quick turn-around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants