Skip to content

Commit 2bc36c9

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

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
@@ -2,12 +2,27 @@
22

33
"""Test cases for "signer.py". """
44

5+
import sys
6+
import unittest
7+
58
import unittest
69
import securesystemslib.formats
710
import securesystemslib.keys as KEYS
8-
from securesystemslib.signer import Signature, SSlibSigner
911
from securesystemslib.exceptions import FormatError, UnsupportedAlgorithmError
1012

13+
# TODO: Remove case handling when fully dropping support for versions < 3.6
14+
IS_PY_VERSION_SUPPORTED = sys.version_info >= (3, 6)
15+
16+
# Use setUpModule to tell unittest runner to skip this test module gracefully.
17+
def setUpModule():
18+
if not IS_PY_VERSION_SUPPORTED:
19+
raise unittest.SkipTest("requires Python 3.6 or higher")
20+
21+
# Since setUpModule is called after imports we need to import conditionally.
22+
if IS_PY_VERSION_SUPPORTED:
23+
from securesystemslib.signer import Signature, SSlibSigner
24+
25+
1126
class TestSSlibSigner(unittest.TestCase):
1227

1328
@classmethod

0 commit comments

Comments
 (0)