Skip to content

Skip test if fpdf is not available #2408

@kitterma

Description

@kitterma

Trying to run the tests in a constrained environment

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

The fpdf module is not available in all environments. It would be nice if the one test that uses is could be skipped if it's not available. See the patch below.

Scott K

diff --git a/tests/test_writer.py b/tests/test_writer.py
index 281232c..22aa8b3 100644
--- a/tests/test_writer.py
+++ b/tests/test_writer.py
@@ -1973,6 +1973,7 @@ REFERENCES 76"""
         bookmarks.append(new_bookmark)


+pytest.importorskip("fpdf")
 def test_merging_many_temporary_files():
     def create_number_pdf(n) -> BytesIO:
         from fpdf import FPDF

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