Skip to content

Commit 0075b9c

Browse files
authored
Merge pull request #400 from hpk/master
Remove optional dependencies from install_requires
2 parents 9e6ddc0 + b71f144 commit 0075b9c

File tree

3 files changed

+34
-17
lines changed

3 files changed

+34
-17
lines changed

setup.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@
88

99
install_requires = [
1010
# core dependencies
11-
'decorator',
1211
'requests >= 1.0.0',
1312
'future',
14-
'paste',
15-
'zope.interface',
16-
'repoze.who',
1713
'cryptography',
1814
'pytz',
1915
'pyOpenSSL',
@@ -22,6 +18,14 @@
2218
'six'
2319
]
2420

21+
extras_require = {
22+
's2repoze': [
23+
'paste',
24+
'zope.interface',
25+
'repoze.who'
26+
]
27+
}
28+
2529
version = ''
2630
with open('src/saml2/__init__.py', 'r') as fd:
2731
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
@@ -56,5 +60,6 @@
5660
scripts=["tools/parse_xsd2.py", "tools/make_metadata.py",
5761
"tools/mdexport.py", "tools/merge_metadata.py"],
5862
install_requires=install_requires,
63+
extras_require=extras_require,
5964
zip_safe=False,
6065
)

tests/test_40_sigver.py

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

21-
#from pyasn1.codec.der import decoder
22-
21+
import pytest
2322
from py.test import raises
2423

2524
from pathutils import full_path
@@ -69,6 +68,10 @@ def _eq(l1, l2):
6968
wKe3ACFXBvqGQN0IbcH49hu0FKhYFM/GPDJcIHFBsiyMBXChpye9vBaTNEBCtU3K
7069
jjyG0hRT2mAQ9h+bkPmOvlEo/aH0xR68Z9hw4PF13w=="""
7170

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

7376

7477
def test_cert_from_instance_1():
@@ -81,16 +84,18 @@ def test_cert_from_instance_1():
8184
assert certs[0] == CERT1
8285

8386

84-
# def test_cert_from_instance_ssp():
85-
# xml_response = open(SIMPLE_SAML_PHP_RESPONSE).read()
86-
# response = samlp.response_from_string(xml_response)
87-
# assertion = response.assertion[0]
88-
# certs = sigver.cert_from_instance(assertion)
89-
# assert len(certs) == 1
90-
# assert certs[0] == CERT_SSP
91-
# der = base64.b64decode(certs[0])
92-
# print(str(decoder.decode(der)).replace('.', "\n."))
93-
# assert decoder.decode(der)
87+
@pytest.mark.skipif(not decoder,
88+
reason="pyasn1 is not installed")
89+
def test_cert_from_instance_ssp():
90+
xml_response = open(SIMPLE_SAML_PHP_RESPONSE).read()
91+
response = samlp.response_from_string(xml_response)
92+
assertion = response.assertion[0]
93+
certs = sigver.cert_from_instance(assertion)
94+
assert len(certs) == 1
95+
assert certs[0] == CERT_SSP
96+
der = base64.b64decode(certs[0])
97+
print(str(decoder.decode(der)).replace('.', "\n."))
98+
assert decoder.decode(der)
9499

95100

96101
class FakeConfig():

tests/test_60_sp.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@
22
# -*- coding: utf-8 -*-
33

44
import base64
5+
import pytest
56
from saml2.authn_context import INTERNETPROTOCOLPASSWORD
67
from saml2.saml import NAMEID_FORMAT_TRANSIENT
78
from saml2.samlp import NameIDPolicy
8-
from saml2.s2repoze.plugins.sp import make_plugin
99
from saml2.server import Server
1010

11+
try:
12+
from saml2.s2repoze.plugins.sp import make_plugin
13+
except ImportError:
14+
make_plugin = None
15+
1116
ENV1 = {'SERVER_SOFTWARE': 'CherryPy/3.1.2 WSGI Server',
1217
'SCRIPT_NAME': '',
1318
'ACTUAL_SERVER_PROTOCOL': 'HTTP/1.1',
@@ -43,6 +48,8 @@
4348
}
4449

4550

51+
@pytest.mark.skipif(not make_plugin,
52+
reason="s2repoze dependencies not installed")
4653
class TestSP():
4754
def setup_class(self):
4855
self.sp = make_plugin("rem", saml_conf="server_conf")

0 commit comments

Comments
 (0)