Skip to content

Commit

Permalink
Annotate tests appropriately (#1551)
Browse files Browse the repository at this point in the history
By annotating these tests, we can use pytest markers to skip external
tests and tests that depend on sample-files.
  • Loading branch information
dkg authored Jan 14, 2023
1 parent f1cd7ae commit 767047b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ def test_get_outline(src, outline_elements):
assert len(outline) == outline_elements


@pytest.mark.samples
@pytest.mark.parametrize(
("src", "expected_images"),
[
Expand Down Expand Up @@ -866,6 +867,7 @@ def test_get_fields():
assert dict(fields["c1-1"]) == ({"/FT": "/Btn", "/T": "c1-1"})


@pytest.mark.external
def test_get_full_qualified_fields():
url = "https://github.com/py-pdf/PyPDF2/files/10142389/fields_with_dots.pdf"
name = "fields_with_dots.pdf"
Expand Down Expand Up @@ -1214,6 +1216,7 @@ def test_zeroing_xref():
len(reader.pages)


@pytest.mark.external
def test_thread():
url = "https://github.com/py-pdf/pypdf/files/9066120/UTA_OSHA_3115_Fall_Protection_Training_09162021_.pdf"
name = "UTA_OSHA.pdf"
Expand All @@ -1226,6 +1229,7 @@ def test_thread():
assert len(reader.threads) >= 1


@pytest.mark.external
def test_build_outline_item(caplog):
url = "https://github.com/py-pdf/pypdf/files/9464742/shiv_resume.pdf"
name = "shiv_resume.pdf"
Expand Down Expand Up @@ -1253,6 +1257,7 @@ def test_build_outline_item(caplog):
assert "Unexpected destination 2" in exc.value.args[0]


@pytest.mark.samples
@pytest.mark.parametrize(
("src", "page_labels"),
[
Expand Down
4 changes: 4 additions & 0 deletions tests/test_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,7 @@ def test_startup_dest():
pdf_file_writer.open_destination = None


@pytest.mark.external
def test_iss471():
url = "https://github.com/py-pdf/pypdf/files/9139245/book.pdf"
name = "book_471.pdf"
Expand All @@ -942,6 +943,7 @@ def test_iss471():
)


@pytest.mark.external
def test_reset_translation():
url = "https://corpora.tika.apache.org/base/docs/govdocs1/924/924666.pdf"
name = "tika-924666.pdf"
Expand Down Expand Up @@ -977,6 +979,7 @@ def test_threads_empty():
assert thr == thr2


@pytest.mark.external
def test_append_without_annots_and_articles():
url = "https://corpora.tika.apache.org/base/docs/govdocs1/924/924666.pdf"
name = "tika-924666.pdf"
Expand All @@ -993,6 +996,7 @@ def test_append_without_annots_and_articles():
assert len(writer.threads) >= 1


@pytest.mark.external
def test_append_multiple():
url = "https://corpora.tika.apache.org/base/docs/govdocs1/924/924666.pdf"
name = "tika-924666.pdf"
Expand Down

0 comments on commit 767047b

Please sign in to comment.