From 53d05ea5c6f2f3b41e044b559fb4fbf6afa8183d Mon Sep 17 00:00:00 2001 From: Hans Kuder Date: Mon, 20 Mar 2017 11:17:50 -0500 Subject: Remove optional dependencies from install_requires --- setup.py | 13 +++++++++---- tests/test_60_sp.py | 9 ++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index b29c31ca..3116e9af 100755 --- a/setup.py +++ b/setup.py @@ -8,12 +8,8 @@ from setuptools.command.test import test as TestCommand install_requires = [ # core dependencies - 'decorator', 'requests >= 1.0.0', 'future', - 'paste', - 'zope.interface', - 'repoze.who', 'cryptography', 'pytz', 'pyOpenSSL', @@ -22,6 +18,14 @@ install_requires = [ 'six' ] +extras_require = { + 's2repoze': [ + 'paste', + 'zope.interface', + 'repoze.who' + ] +} + version = '' with open('src/saml2/__init__.py', 'r') as fd: version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', @@ -56,5 +60,6 @@ setup( scripts=["tools/parse_xsd2.py", "tools/make_metadata.py", "tools/mdexport.py", "tools/merge_metadata.py"], install_requires=install_requires, + extras_require=extras_require, zip_safe=False, ) diff --git a/tests/test_60_sp.py b/tests/test_60_sp.py index 6448d6d8..65504635 100644 --- a/tests/test_60_sp.py +++ b/tests/test_60_sp.py @@ -2,12 +2,17 @@ # -*- coding: utf-8 -*- import base64 +import pytest from saml2.authn_context import INTERNETPROTOCOLPASSWORD from saml2.saml import NAMEID_FORMAT_TRANSIENT from saml2.samlp import NameIDPolicy -from saml2.s2repoze.plugins.sp import make_plugin from saml2.server import Server +try: + from saml2.s2repoze.plugins.sp import make_plugin +except ImportError: + make_plugin = None + ENV1 = {'SERVER_SOFTWARE': 'CherryPy/3.1.2 WSGI Server', 'SCRIPT_NAME': '', 'ACTUAL_SERVER_PROTOCOL': 'HTTP/1.1', @@ -43,6 +48,8 @@ AUTHN = { } +@pytest.mark.skipif(not make_plugin, + reason="s2repoze dependencies not installed") class TestSP(): def setup_class(self): self.sp = make_plugin("rem", saml_conf="server_conf") -- cgit v1.2.1 From 546f9d4ca82c8b4ae5cf7aa0fb80f0bedf385c89 Mon Sep 17 00:00:00 2001 From: Hans Kuder Date: Mon, 20 Mar 2017 11:41:45 -0500 Subject: Skip test if optional pyasn1 is not installed --- tests/test_40_sigver.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_40_sigver.py b/tests/test_40_sigver.py index e2ba952f..2511efc4 100644 --- a/tests/test_40_sigver.py +++ b/tests/test_40_sigver.py @@ -18,6 +18,7 @@ from saml2.saml import EncryptedAssertion from saml2.samlp import response_from_string from saml2.s_utils import factory, do_attribute_statement +import pytest from py.test import raises from pathutils import full_path @@ -67,7 +68,10 @@ Yj4cAafWaYfjBU2zi1ElwStIaJ5nyp/s/8B8SAPK2T79McMyccP3wSW13LHkmM1j wKe3ACFXBvqGQN0IbcH49hu0FKhYFM/GPDJcIHFBsiyMBXChpye9vBaTNEBCtU3K jjyG0hRT2mAQ9h+bkPmOvlEo/aH0xR68Z9hw4PF13w==""" -from pyasn1.codec.der import decoder +try: + from pyasn1.codec.der import decoder +except ImportError: + decoder = None def test_cert_from_instance_1(): @@ -80,6 +84,8 @@ def test_cert_from_instance_1(): assert certs[0] == CERT1 +@pytest.mark.skipif(not decoder, + reason="pyasn1 is not installed") def test_cert_from_instance_ssp(): xml_response = open(SIMPLE_SAML_PHP_RESPONSE).read() response = samlp.response_from_string(xml_response) -- cgit v1.2.1