Skip to content

Commit

Permalink
skip tests if optional packages are not found
Browse files Browse the repository at this point in the history
  • Loading branch information
FriedrichFroebel committed Jan 25, 2024
1 parent 1a6bab0 commit 3e7a01c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/examples/test_djvu2png.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import os
import subprocess
from importlib.util import find_spec
from tempfile import NamedTemporaryFile
from unittest import SkipTest

from tests.tools import EXAMPLES, IMAGES, TestCase


class Djvu2PngTestCase(TestCase):
@classmethod
def setUpClass(cls):
if find_spec('numpy') is None:
raise SkipTest('Package numpy not found.')
if find_spec('cairocffi') is None or find_spec('pycairo') is None:
raise SkipTest('Cairo bindings not found.')

def check(self, mode: str):
with NamedTemporaryFile(suffix='.png') as outfile:
subprocess.run(
Expand Down

0 comments on commit 3e7a01c

Please sign in to comment.