Skip to content

Commit 546f9d4

Browse files
committed
Skip test if optional pyasn1 is not installed
1 parent 53d05ea commit 546f9d4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/test_40_sigver.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from saml2.samlp import response_from_string
1919
from saml2.s_utils import factory, do_attribute_statement
2020

21+
import pytest
2122
from py.test import raises
2223

2324
from pathutils import full_path
@@ -67,7 +68,10 @@ def _eq(l1, l2):
6768
wKe3ACFXBvqGQN0IbcH49hu0FKhYFM/GPDJcIHFBsiyMBXChpye9vBaTNEBCtU3K
6869
jjyG0hRT2mAQ9h+bkPmOvlEo/aH0xR68Z9hw4PF13w=="""
6970

70-
from pyasn1.codec.der import decoder
71+
try:
72+
from pyasn1.codec.der import decoder
73+
except ImportError:
74+
decoder = None
7175

7276

7377
def test_cert_from_instance_1():
@@ -80,6 +84,8 @@ def test_cert_from_instance_1():
8084
assert certs[0] == CERT1
8185

8286

87+
@pytest.mark.skipif(not decoder,
88+
reason="pyasn1 is not installed")
8389
def test_cert_from_instance_ssp():
8490
xml_response = open(SIMPLE_SAML_PHP_RESPONSE).read()
8591
response = samlp.response_from_string(xml_response)

0 commit comments

Comments
 (0)