Require backports.ssl_match_hostname package for tests.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/34b7e02c Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/34b7e02c Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/34b7e02c Branch: refs/heads/trunk Commit: 34b7e02cf1f6594fd500311563e48506c554e3a6 Parents: 884de66 Author: Tomaz Muraus <[email protected]> Authored: Thu Nov 20 00:00:53 2014 +0800 Committer: Tomaz Muraus <[email protected]> Committed: Thu Nov 20 00:00:53 2014 +0800 ---------------------------------------------------------------------- setup.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/34b7e02c/setup.py ---------------------------------------------------------------------- diff --git a/setup.py b/setup.py index b8daaa4..63e9ce7 100644 --- a/setup.py +++ b/setup.py @@ -46,6 +46,11 @@ DOC_TEST_MODULES = ['libcloud.compute.drivers.dummy', SUPPORTED_VERSIONS = ['2.5', '2.6', '2.7', 'PyPy', '3.x'] +TEST_REQUIREMENTS = [ + 'backports.ssl_match_hostname', + 'mock' +] + if sys.version_info <= (2, 4): version = '.'.join([str(x) for x in sys.version_info[:3]]) print('Version ' + version + ' is not supported. Supported versions are ' + @@ -91,14 +96,15 @@ class TestCommand(Command): pass def run(self): - try: - import mock - mock - except ImportError: - print('Missing "mock" library. mock is library is needed ' - 'to run the tests. You can install it using pip: ' - 'pip install mock') - sys.exit(1) + for module_name in TEST_REQUIREMENTS: + try: + __import__(module_name) + except ImportError: + print('Missing "%s" library. %s is library is needed ' + 'to run the tests. You can install it using pip: ' + 'pip install %s' % (module_name, module_name, + module_name)) + sys.exit(1) if unittest2_required: try:
