Skip to content

Commit

Permalink
Isolate docs requirements
Browse files Browse the repository at this point in the history
...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
  • Loading branch information
tipabu committed Jun 27, 2019
1 parent b52c13f commit 113eacf
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 19 deletions.
5 changes: 5 additions & 0 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Empty file added doc/source/_static/.gitignore
Empty file.
8 changes: 8 additions & 0 deletions swiftclient/multithreading.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ def __init__(self, create_connection, max_workers):
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
Expand Down
2 changes: 1 addition & 1 deletion swiftclient/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
42 changes: 28 additions & 14 deletions tests/functional/test_swiftclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,34 @@ def _get_config(self):
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')
Expand All @@ -59,15 +82,6 @@ def _get_config(self):
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

Expand Down
6 changes: 5 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 113eacf

Please sign in to comment.