From b82d3c25de0ba511c339daecc3a8831d3f3a5684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 12 Mar 2019 16:05:03 +0100 Subject: [PATCH] fix: Do not run PDF Export tests on python < 3.6 --- tests/test_reportlab.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/test_reportlab.py b/tests/test_reportlab.py index 17ff8e6..28605df 100644 --- a/tests/test_reportlab.py +++ b/tests/test_reportlab.py @@ -7,17 +7,20 @@ import time import unittest from pymisp import MISPEvent -from pymisp.tools import reportlab_generator manual_testing = False -if sys.version_info < (3, 6): - print('This test suite requires Python 3.6+, breaking.') - sys.exit(0) -else: - from pymisp import reportlab_generator +try: + from pymisp.tools import reportlab_generator +except ImportError: + if sys.version_info < (3, 6): + print('This test suite requires Python 3.6+, breaking.') + sys.exit(0) + else: + raise -class TestMISPEvent(unittest.TestCase): + +class TestPDFExport(unittest.TestCase): def setUp(self): self.maxDiff = None @@ -35,7 +38,6 @@ class TestMISPEvent(unittest.TestCase): self.moduleconfig = ["MISP_base_url_for_dynamic_link", "MISP_name_for_metadata", "Activate_textual_description", "Activate_galaxy_description", "Activate_related_events", "Activate_internationalization_fonts", "Custom_fonts_path"] - def init_event(self): self.mispevent.info = 'This is a test' self.mispevent.distribution = 1 @@ -409,7 +411,6 @@ class TestMISPEvent(unittest.TestCase): config[self.moduleconfig[4]] = True config[self.moduleconfig[5]] = True - file_nb = str(len(os.listdir(self.test_batch_folder))) i = 0 t = time.time()