diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2014-01-12 20:38:21 -0500 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2014-01-12 21:58:53 -0500 |
commit | d48337dbdb333b7e545aa59a1a4c6d3f2b834a54 (patch) | |
tree | a6efa7797be6e8983288e23753b7a66057a307f2 | |
parent | 14edd084d4a7c5323a795139eb43141f3781ebc4 (diff) | |
download | pycurl-d48337dbdb333b7e545aa59a1a4c6d3f2b834a54.tar.gz |
Add tests for HAVE_CURL_SSL define
-rw-r--r-- | setup.py | 4 | ||||
-rwxr-xr-x | tests/fake-curl/curl-config-ssl-feature-only | 18 | ||||
-rw-r--r-- | tests/setup_test.py | 26 |
3 files changed, 48 insertions, 0 deletions
@@ -64,6 +64,10 @@ class ExtensionConfiguration(object): self.configure() + @property + def define_symbols(self): + return [symbol for symbol, expansion in self.define_macros] + # append contents of an environment variable to library_dirs[] def add_libdirs(self, envvar, sep, fatal=False): v = os.environ.get(envvar) diff --git a/tests/fake-curl/curl-config-ssl-feature-only b/tests/fake-curl/curl-config-ssl-feature-only new file mode 100755 index 0000000..3999f11 --- /dev/null +++ b/tests/fake-curl/curl-config-ssl-feature-only @@ -0,0 +1,18 @@ +#!/bin/sh + +# A curl-config that indicates SSL is supported but does not say +# which SSL library is being used + +output= + +while test -n "$1"; do + case "$1" in + --libs) + echo '-lcurl' + ;; + --features) + echo 'SSL' + ;; + esac + shift +done diff --git a/tests/setup_test.py b/tests/setup_test.py index 70bdef7..b5c4d5b 100644 --- a/tests/setup_test.py +++ b/tests/setup_test.py @@ -55,3 +55,29 @@ class SetupTest(unittest.TestCase): config = pycurl_setup.ExtensionConfiguration() # should link against openssl assert 'ssl' in config.libraries + + @using_curl_config('curl-config-empty') + def test_no_ssl_define(self): + config = pycurl_setup.ExtensionConfiguration() + # ssl define should be off + assert 'HAVE_CURL_SSL' not in config.define_symbols + + @using_curl_config('curl-config-ssl-in-libs') + def test_ssl_in_libs_sets_ssl_define(self): + config = pycurl_setup.ExtensionConfiguration() + # ssl define should be on + assert 'HAVE_CURL_SSL' in config.define_symbols + + @using_curl_config('curl-config-ssl-in-static-libs') + def test_ssl_in_static_libs_sets_ssl_define(self): + raise nose.plugins.skip.SkipTest('this test fails') + + config = pycurl_setup.ExtensionConfiguration() + # ssl define should be on + assert 'HAVE_CURL_SSL' in config.define_symbols + + @using_curl_config('curl-config-ssl-feature-only') + def test_ssl_feature_sets_ssl_define(self): + config = pycurl_setup.ExtensionConfiguration() + # ssl define should be on + assert 'HAVE_CURL_SSL' in config.define_symbols |