From a2d7cbd7632da23cb0816fa0b041b939d4d520b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Mon, 15 Mar 2021 13:50:48 +0100 Subject: [PATCH] fix: Make reportlab tests optional if missing dep. --- tests/test_reportlab.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/test_reportlab.py b/tests/test_reportlab.py index 3520c73..8fd40ee 100644 --- a/tests/test_reportlab.py +++ b/tests/test_reportlab.py @@ -6,26 +6,23 @@ import sys import time import unittest -from pymisp import MISPEvent - -manual_testing = False - import logging logging.disable(logging.CRITICAL) +manual_testing = False try: + from pymisp import MISPEvent from pymisp.tools import reportlab_generator + reportlab_missing = False except Exception: - if sys.version_info < (3, 6): - print('This test suite requires Python 3.6+, breaking.') - sys.exit(0) - else: - raise + reportlab_missing = True class TestPDFExport(unittest.TestCase): def setUp(self): + if reportlab_missing: + self.skipTest('reportlab missing, skip test.') self.maxDiff = None self.mispevent = MISPEvent() if not manual_testing: