Skip to content

Commit 113eacf

Browse files
committed
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
1 parent b52c13f commit 113eacf

File tree

7 files changed

+47
-19
lines changed

7 files changed

+47
-19
lines changed

doc/requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
keystoneauth1>=3.4.0 # Apache-2.0
2+
sphinx!=1.6.6,!=1.6.7,<2.0.0,>=1.6.2;python_version=='2.7' # BSD
3+
sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2;python_version>='3.4' # BSD
4+
reno>=2.5.0 # Apache-2.0
5+
openstackdocstheme>=1.18.1 # Apache-2.0

doc/source/_static/.gitignore

Whitespace-only changes.

swiftclient/multithreading.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,14 @@ def __init__(self, create_connection, max_workers):
175175
super(ConnectionThreadPoolExecutor, self).__init__(max_workers)
176176

177177
def submit(self, fn, *args, **kwargs):
178+
"""
179+
Schedules the callable, `fn`, to be executed
180+
181+
:param fn: the callable to be invoked
182+
:param args: the positional arguments for the callable
183+
:param kwargs: the keyword arguments for the callable
184+
:returns: a Future object representing the execution of the callable
185+
"""
178186
def conn_fn():
179187
priority = None
180188
conn = None

swiftclient/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def generate_temp_url(path, seconds, key, method, absolute=False,
7474
Swift object.
7575
7676
:param path: The full path to the Swift object or prefix if
77-
a prefix-based temporary URL should be generated. Example:
77+
a prefix-based temporary URL should be generated. Example:
7878
/v1/AUTH_account/c/o or /v1/AUTH_account/c/prefix.
7979
:param seconds: time in seconds or ISO 8601 timestamp.
8080
If absolute is False and this is the string representation of an

test-requirements.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,4 @@ hacking>=1.1.0,<1.2.0 # Apache-2.0
33
coverage!=4.4,>=4.0 # Apache-2.0
44
keystoneauth1>=3.4.0 # Apache-2.0
55
mock>=1.2.0 # BSD
6-
sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD
76
stestr>=2.0.0 # Apache-2.0
8-
reno>=2.5.0 # Apache-2.0
9-
openstackdocstheme>=1.18.1 # Apache-2.0

tests/functional/test_swiftclient.py

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,34 @@ def _get_config(self):
4646
config.read(config_file)
4747
self.config = config
4848
if config.has_section('func_test'):
49-
auth_host = config.get('func_test', 'auth_host')
50-
auth_port = config.getint('func_test', 'auth_port')
51-
auth_ssl = config.getboolean('func_test', 'auth_ssl')
52-
auth_prefix = config.get('func_test', 'auth_prefix')
53-
self.auth_version = config.get('func_test', 'auth_version')
49+
if config.has_option('func_test', 'auth_uri'):
50+
self.auth_url = config.get('func_test', 'auth_uri')
51+
try:
52+
self.auth_version = config.get('func_test', 'auth_version')
53+
except configparser.NoOptionError:
54+
last_piece = self.auth_url.rstrip('/').rsplit('/', 1)[1]
55+
if last_piece.endswith('.0'):
56+
last_piece = last_piece[:-2]
57+
if last_piece in ('1', '2', '3'):
58+
self.auth_version = last_piece
59+
else:
60+
raise
61+
else:
62+
auth_host = config.get('func_test', 'auth_host')
63+
auth_port = config.getint('func_test', 'auth_port')
64+
auth_ssl = config.getboolean('func_test', 'auth_ssl')
65+
auth_prefix = config.get('func_test', 'auth_prefix')
66+
self.auth_version = config.get('func_test', 'auth_version')
67+
self.auth_url = ""
68+
if auth_ssl:
69+
self.auth_url += "https://"
70+
else:
71+
self.auth_url += "http://"
72+
self.auth_url += "%s:%s%s" % (
73+
auth_host, auth_port, auth_prefix)
74+
if self.auth_version == "1":
75+
self.auth_url += 'v1.0'
76+
5477
try:
5578
self.account_username = config.get('func_test',
5679
'account_username')
@@ -59,15 +82,6 @@ def _get_config(self):
5982
username = config.get('func_test', 'username')
6083
self.account_username = "%s:%s" % (account, username)
6184
self.password = config.get('func_test', 'password')
62-
self.auth_url = ""
63-
if auth_ssl:
64-
self.auth_url += "https://"
65-
else:
66-
self.auth_url += "http://"
67-
self.auth_url += "%s:%s%s" % (auth_host, auth_port, auth_prefix)
68-
if self.auth_version == "1":
69-
self.auth_url += 'v1.0'
70-
7185
else:
7286
self.skip_tests = True
7387

tox.ini

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ commands = {[testenv:func]commands}
6565

6666
[testenv:docs]
6767
basepython = python3
68+
usedevelop = False
69+
deps = -r{toxinidir}/doc/requirements.txt
6870
commands=
69-
python setup.py build_sphinx
71+
python setup.py build_sphinx -W
7072

7173
[flake8]
7274
# it's not a bug that we aren't using all of hacking, ignore:
@@ -96,6 +98,8 @@ commands = bindep test
9698

9799
[testenv:releasenotes]
98100
basepython = python3
101+
usedevelop = False
102+
deps = -r{toxinidir}/doc/requirements.txt
99103
commands = sphinx-build -a -W -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
100104

101105
[testenv:lower-constraints]

0 commit comments

Comments
 (0)