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 test annocations in 4.1.0 #2506

Closed
kitterma opened this issue Mar 8, 2024 · 4 comments · Fixed by #2507
Closed

Missing test annocations in 4.1.0 #2506

kitterma opened this issue Mar 8, 2024 · 4 comments · Fixed by #2507

Comments

@kitterma
Copy link
Contributor

kitterma commented Mar 8, 2024

Replace this: What happened? What were you trying to achieve?

Environment

Building and running tests in Debian.

$ python -m platform
Linux-6.1.0-18-amd64-x86_64-with-glibc2.37

$ python -c "import pypdf;print(pypdf._debug_versions)"
4.1.0

Code + PDF

This is a minimal, complete example that shows the issue:

N/A

In this release, get_data_from_url is missing enable_socket and tests/scripts/test_make_release.py fails since make_release.py is (correctly) not included in the release as it's only useful upstream. Patch for both issues provided below.

From: Scott Kitterman <[email protected]>
Date: Fri, 8 Mar 2024 00:25:05 -0500
Subject: Fix test exceptions

---
 tests/scripts/test_make_release.py | 8 +++++++-
 tests/test_generic.py              | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/scripts/test_make_release.py b/tests/scripts/test_make_release.py
index 51b5e5a..e1250fe 100644
--- a/tests/scripts/test_make_release.py
+++ b/tests/scripts/test_make_release.py
@@ -1,8 +1,12 @@
 """Test the `make_release.py` script."""
 from pathlib import Path
 from unittest import mock
+import pytest

-import make_release
+try:
+    import make_release
+except:
+    pass

 DATA_PATH = Path(__file__).parent.resolve() / "data"

@@ -17,6 +21,7 @@ f851a532a5ec23b572d86bd7185b327a3fac6b58:::DEV: Bump codecov/codecov-action from
 COMMITS__VERSION_4_0_1 = DATA_PATH.joinpath("commits__version_4_0_1.json")


+pytest.importorskip("make_release")
 def test_get_git_commits_since_tag():
     with open(COMMITS__VERSION_4_0_1, mode="rb") as commits, \
             mock.patch("urllib.request.urlopen", side_effect=lambda n: commits), \
@@ -61,6 +66,7 @@ def test_get_git_commits_since_tag():
     ]


+pytest.importorskip("make_release")
 def test_get_formatted_changes():
     with open(COMMITS__VERSION_4_0_1, mode="rb") as commits, \
             mock.patch("urllib.request.urlopen", side_effect=lambda n: commits), \
diff --git a/tests/test_generic.py b/tests/test_generic.py
index f77b018..f31a4f1 100644
--- a/tests/test_generic.py
+++ b/tests/test_generic.py
@@ -1247,6 +1247,7 @@ def test_encodedstream_set_data():
     assert cc[NameObject("/Test")] == "/MyTest"


[email protected]_socket()
 def test_calling_indirect_objects():
     """Cope with cases where attributes/items are called from indirectObject"""
     url = (
@stefan6419846
Copy link
Collaborator

Thanks for the report. Do you want to submit a corresponding PR?

@kitterma
Copy link
Contributor Author

kitterma commented Mar 8, 2024 via email

@stefan6419846
Copy link
Collaborator

stefan6419846 commented Mar 8, 2024

I have converted your patch into a corresponding PR for further inclusion into pypdf once this has been approved by one of the other maintainers.

@kitterma
Copy link
Contributor Author

kitterma commented Mar 8, 2024 via email

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