mirror of https://github.com/MISP/PyMISP
fix: Make reportlab tests optional if missing dep.
parent
49ef62d930
commit
a2d7cbd763
|
@ -6,26 +6,23 @@ import sys
|
||||||
import time
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from pymisp import MISPEvent
|
|
||||||
|
|
||||||
manual_testing = False
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
logging.disable(logging.CRITICAL)
|
logging.disable(logging.CRITICAL)
|
||||||
|
manual_testing = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
from pymisp import MISPEvent
|
||||||
from pymisp.tools import reportlab_generator
|
from pymisp.tools import reportlab_generator
|
||||||
|
reportlab_missing = False
|
||||||
except Exception:
|
except Exception:
|
||||||
if sys.version_info < (3, 6):
|
reportlab_missing = True
|
||||||
print('This test suite requires Python 3.6+, breaking.')
|
|
||||||
sys.exit(0)
|
|
||||||
else:
|
|
||||||
raise
|
|
||||||
|
|
||||||
|
|
||||||
class TestPDFExport(unittest.TestCase):
|
class TestPDFExport(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
if reportlab_missing:
|
||||||
|
self.skipTest('reportlab missing, skip test.')
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
self.mispevent = MISPEvent()
|
self.mispevent = MISPEvent()
|
||||||
if not manual_testing:
|
if not manual_testing:
|
||||||
|
|
Loading…
Reference in New Issue