Skip to content

Commit 0978f5e

Browse files
committed
Skip test_signer on Python2.7
Signed-off-by: Martin Vrachev <[email protected]>
1 parent b1f7933 commit 0978f5e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tests/test_signer.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,27 @@
1717
Test cases for 'signer.py'.
1818
"""
1919

20+
import sys
21+
import unittest
22+
2023
import unittest
2124
import securesystemslib.formats
2225
import securesystemslib.keys as KEYS
23-
from securesystemslib.signer import Signature, SSlibSigner
2426
from securesystemslib.exceptions import FormatError, UnsupportedAlgorithmError
2527

28+
# TODO: Remove case handling when fully dropping support for versions >= 3.6
29+
IS_PY_VERSION_SUPPORTED = sys.version_info >= (3, 6)
30+
31+
# Use setUpModule to tell unittest runner to skip this test module gracefully.
32+
def setUpModule():
33+
if not IS_PY_VERSION_SUPPORTED:
34+
raise unittest.SkipTest('requires Python 3.6 or higher')
35+
36+
# Since setUpModule is called after imports we need to import conditionally.
37+
if IS_PY_VERSION_SUPPORTED:
38+
from securesystemslib.signer import Signature, SSlibSigner
39+
40+
2641
class TestSSlibSigner(unittest.TestCase):
2742

2843
@classmethod

0 commit comments

Comments
 (0)