From 113eacf3b80f61d366b3e95b558b40f82ff728a4 Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Tue, 25 Jun 2019 15:43:29 -0700 Subject: Isolate docs requirements ...since modern sphinx won't install on py27. While we're at it, clean up some warnings and treat warnings as errors. Also, fix up how we parse test configs so we can run func tests. Related-Change: Id3c2ed87230c5918c18e2c01d086df8157f036b1 Change-Id: I3718f69610545b0dbcb0a2ab45b400da3a45682c --- doc/requirements.txt | 5 +++++ doc/source/_static/.gitignore | 0 swiftclient/multithreading.py | 8 +++++++ swiftclient/utils.py | 2 +- test-requirements.txt | 3 --- tests/functional/test_swiftclient.py | 42 ++++++++++++++++++++++++------------ tox.ini | 6 +++++- 7 files changed, 47 insertions(+), 19 deletions(-) create mode 100644 doc/requirements.txt create mode 100644 doc/source/_static/.gitignore diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 0000000..d8f432e --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,5 @@ +keystoneauth1>=3.4.0 # Apache-2.0 +sphinx!=1.6.6,!=1.6.7,<2.0.0,>=1.6.2;python_version=='2.7' # BSD +sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2;python_version>='3.4' # BSD +reno>=2.5.0 # Apache-2.0 +openstackdocstheme>=1.18.1 # Apache-2.0 diff --git a/doc/source/_static/.gitignore b/doc/source/_static/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/swiftclient/multithreading.py b/swiftclient/multithreading.py index 5e03ed7..fcf0ed9 100644 --- a/swiftclient/multithreading.py +++ b/swiftclient/multithreading.py @@ -175,6 +175,14 @@ class ConnectionThreadPoolExecutor(ThreadPoolExecutor): super(ConnectionThreadPoolExecutor, self).__init__(max_workers) def submit(self, fn, *args, **kwargs): + """ + Schedules the callable, `fn`, to be executed + + :param fn: the callable to be invoked + :param args: the positional arguments for the callable + :param kwargs: the keyword arguments for the callable + :returns: a Future object representing the execution of the callable + """ def conn_fn(): priority = None conn = None diff --git a/swiftclient/utils.py b/swiftclient/utils.py index 5c17c61..87a4390 100644 --- a/swiftclient/utils.py +++ b/swiftclient/utils.py @@ -74,7 +74,7 @@ def generate_temp_url(path, seconds, key, method, absolute=False, Swift object. :param path: The full path to the Swift object or prefix if - a prefix-based temporary URL should be generated. Example: + a prefix-based temporary URL should be generated. Example: /v1/AUTH_account/c/o or /v1/AUTH_account/c/prefix. :param seconds: time in seconds or ISO 8601 timestamp. If absolute is False and this is the string representation of an diff --git a/test-requirements.txt b/test-requirements.txt index d822214..b3ca5f8 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,7 +3,4 @@ hacking>=1.1.0,<1.2.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 keystoneauth1>=3.4.0 # Apache-2.0 mock>=1.2.0 # BSD -sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD stestr>=2.0.0 # Apache-2.0 -reno>=2.5.0 # Apache-2.0 -openstackdocstheme>=1.18.1 # Apache-2.0 diff --git a/tests/functional/test_swiftclient.py b/tests/functional/test_swiftclient.py index b4f275b..bae3044 100644 --- a/tests/functional/test_swiftclient.py +++ b/tests/functional/test_swiftclient.py @@ -46,11 +46,34 @@ class TestFunctional(unittest.TestCase): config.read(config_file) self.config = config if config.has_section('func_test'): - auth_host = config.get('func_test', 'auth_host') - auth_port = config.getint('func_test', 'auth_port') - auth_ssl = config.getboolean('func_test', 'auth_ssl') - auth_prefix = config.get('func_test', 'auth_prefix') - self.auth_version = config.get('func_test', 'auth_version') + if config.has_option('func_test', 'auth_uri'): + self.auth_url = config.get('func_test', 'auth_uri') + try: + self.auth_version = config.get('func_test', 'auth_version') + except configparser.NoOptionError: + last_piece = self.auth_url.rstrip('/').rsplit('/', 1)[1] + if last_piece.endswith('.0'): + last_piece = last_piece[:-2] + if last_piece in ('1', '2', '3'): + self.auth_version = last_piece + else: + raise + else: + auth_host = config.get('func_test', 'auth_host') + auth_port = config.getint('func_test', 'auth_port') + auth_ssl = config.getboolean('func_test', 'auth_ssl') + auth_prefix = config.get('func_test', 'auth_prefix') + self.auth_version = config.get('func_test', 'auth_version') + self.auth_url = "" + if auth_ssl: + self.auth_url += "https://" + else: + self.auth_url += "http://" + self.auth_url += "%s:%s%s" % ( + auth_host, auth_port, auth_prefix) + if self.auth_version == "1": + self.auth_url += 'v1.0' + try: self.account_username = config.get('func_test', 'account_username') @@ -59,15 +82,6 @@ class TestFunctional(unittest.TestCase): username = config.get('func_test', 'username') self.account_username = "%s:%s" % (account, username) self.password = config.get('func_test', 'password') - self.auth_url = "" - if auth_ssl: - self.auth_url += "https://" - else: - self.auth_url += "http://" - self.auth_url += "%s:%s%s" % (auth_host, auth_port, auth_prefix) - if self.auth_version == "1": - self.auth_url += 'v1.0' - else: self.skip_tests = True diff --git a/tox.ini b/tox.ini index 4635491..84a5419 100644 --- a/tox.ini +++ b/tox.ini @@ -65,8 +65,10 @@ commands = {[testenv:func]commands} [testenv:docs] basepython = python3 +usedevelop = False +deps = -r{toxinidir}/doc/requirements.txt commands= - python setup.py build_sphinx + python setup.py build_sphinx -W [flake8] # it's not a bug that we aren't using all of hacking, ignore: @@ -96,6 +98,8 @@ commands = bindep test [testenv:releasenotes] basepython = python3 +usedevelop = False +deps = -r{toxinidir}/doc/requirements.txt commands = sphinx-build -a -W -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html [testenv:lower-constraints] -- cgit v1.2.1