Skip to content

Commit

Permalink
Skip test if pdfplumber is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
bosd committed Mar 13, 2023
1 parent 1975a77 commit 0f50bc3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@
from .common import get_sample_files


def have_pdfplumber():
try:
import pdfplumber # noqa: F401
except ImportError:
return False
return True


needs_pdfplumber = unittest.skipIf(not have_pdfplumber(), reason="requires pdfplumber\n")


def _extract_data_for_export():
pdf_files = get_sample_files('.pdf')
for file in pdf_files:
Expand Down Expand Up @@ -87,6 +98,7 @@ def test_extract_data_pdfminer(self):
self.assertTrue(False, "pdfminer is not installed")
self.assertTrue(type(res) is str, "return is not a string")

@needs_pdfplumber
def test_extract_data_pdfplumber(self):
pdf_files = get_sample_files('.pdf')
for file in pdf_files:
Expand Down

0 comments on commit 0f50bc3

Please sign in to comment.