Merge "Raise hacking version to 2.0.0"
This commit is contained in:
commit
dea742c940
@ -14,9 +14,7 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
"""
|
"""OpenStack Client interface. Handles the REST calls and responses."""
|
||||||
OpenStack Client interface. Handles the REST calls and responses.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
@ -429,7 +427,7 @@ class HTTPClient(object):
|
|||||||
url = self.management_url + url
|
url = self.management_url + url
|
||||||
resp, body = self.request(url, method, **kwargs)
|
resp, body = self.request(url, method, **kwargs)
|
||||||
return resp, body
|
return resp, body
|
||||||
except exceptions.BadRequest as e:
|
except exceptions.BadRequest:
|
||||||
if attempts > self.retries:
|
if attempts > self.retries:
|
||||||
raise
|
raise
|
||||||
except exceptions.Unauthorized:
|
except exceptions.Unauthorized:
|
||||||
|
@ -118,10 +118,10 @@ class ShellTest(utils.TestCase):
|
|||||||
def test_help(self):
|
def test_help(self):
|
||||||
# Some expected help output, including microversioned commands
|
# Some expected help output, including microversioned commands
|
||||||
required = [
|
required = [
|
||||||
'.*?^usage: ',
|
r'.*?^usage: ',
|
||||||
'.*?(?m)^\s+create\s+Creates a volume.',
|
r'.*?(?m)^\s+create\s+Creates a volume.',
|
||||||
'.*?(?m)^\s+summary\s+Get volumes summary.',
|
r'.*?(?m)^\s+summary\s+Get volumes summary.',
|
||||||
'.*?(?m)^Run "cinder help SUBCOMMAND" for help on a subcommand.',
|
r'.*?(?m)^Run "cinder help SUBCOMMAND" for help on a subcommand.',
|
||||||
]
|
]
|
||||||
help_text = self.shell('help')
|
help_text = self.shell('help')
|
||||||
for r in required:
|
for r in required:
|
||||||
@ -130,8 +130,8 @@ class ShellTest(utils.TestCase):
|
|||||||
|
|
||||||
def test_help_on_subcommand(self):
|
def test_help_on_subcommand(self):
|
||||||
required = [
|
required = [
|
||||||
'.*?^usage: cinder list',
|
r'.*?^usage: cinder list',
|
||||||
'.*?(?m)^Lists all volumes.',
|
r'.*?(?m)^Lists all volumes.',
|
||||||
]
|
]
|
||||||
help_text = self.shell('help list')
|
help_text = self.shell('help list')
|
||||||
for r in required:
|
for r in required:
|
||||||
@ -140,8 +140,8 @@ class ShellTest(utils.TestCase):
|
|||||||
|
|
||||||
def test_help_on_subcommand_mv(self):
|
def test_help_on_subcommand_mv(self):
|
||||||
required = [
|
required = [
|
||||||
'.*?^usage: cinder summary',
|
r'.*?^usage: cinder summary',
|
||||||
'.*?(?m)^Get volumes summary.',
|
r'.*?(?m)^Get volumes summary.',
|
||||||
]
|
]
|
||||||
help_text = self.shell('help summary')
|
help_text = self.shell('help summary')
|
||||||
for r in required:
|
for r in required:
|
||||||
|
@ -33,22 +33,24 @@ def _get_default_RateLimit(verb="verb1", uri="uri1", regex="regex1",
|
|||||||
|
|
||||||
class TestLimits(utils.TestCase):
|
class TestLimits(utils.TestCase):
|
||||||
def test_repr(self):
|
def test_repr(self):
|
||||||
l = limits.Limits(None, {"foo": "bar"}, resp=REQUEST_ID)
|
limit = limits.Limits(None, {"foo": "bar"}, resp=REQUEST_ID)
|
||||||
self.assertEqual("<Limits>", repr(l))
|
self.assertEqual("<Limits>", repr(limit))
|
||||||
self._assert_request_id(l)
|
self._assert_request_id(limit)
|
||||||
|
|
||||||
def test_absolute(self):
|
def test_absolute(self):
|
||||||
l = limits.Limits(None,
|
limit = limits.Limits(
|
||||||
|
None,
|
||||||
{"absolute": {"name1": "value1", "name2": "value2"}},
|
{"absolute": {"name1": "value1", "name2": "value2"}},
|
||||||
resp=REQUEST_ID)
|
resp=REQUEST_ID)
|
||||||
l1 = limits.AbsoluteLimit("name1", "value1")
|
l1 = limits.AbsoluteLimit("name1", "value1")
|
||||||
l2 = limits.AbsoluteLimit("name2", "value2")
|
l2 = limits.AbsoluteLimit("name2", "value2")
|
||||||
for item in l.absolute:
|
for item in limit.absolute:
|
||||||
self.assertIn(item, [l1, l2])
|
self.assertIn(item, [l1, l2])
|
||||||
self._assert_request_id(l)
|
self._assert_request_id(limit)
|
||||||
|
|
||||||
def test_rate(self):
|
def test_rate(self):
|
||||||
l = limits.Limits(None,
|
limit = limits.Limits(
|
||||||
|
None,
|
||||||
{
|
{
|
||||||
"rate": [
|
"rate": [
|
||||||
{
|
{
|
||||||
@ -76,17 +78,16 @@ class TestLimits(utils.TestCase):
|
|||||||
"next-available": "next2",
|
"next-available": "next2",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
}, ],
|
||||||
],
|
|
||||||
},
|
},
|
||||||
resp=REQUEST_ID)
|
resp=REQUEST_ID)
|
||||||
l1 = limits.RateLimit("verb1", "uri1", "regex1", "value1", "remain1",
|
l1 = limits.RateLimit("verb1", "uri1", "regex1", "value1", "remain1",
|
||||||
"unit1", "next1")
|
"unit1", "next1")
|
||||||
l2 = limits.RateLimit("verb2", "uri2", "regex2", "value2", "remain2",
|
l2 = limits.RateLimit("verb2", "uri2", "regex2", "value2", "remain2",
|
||||||
"unit2", "next2")
|
"unit2", "next2")
|
||||||
for item in l.rate:
|
for item in limit.rate:
|
||||||
self.assertIn(item, [l1, l2])
|
self.assertIn(item, [l1, l2])
|
||||||
self._assert_request_id(l)
|
self._assert_request_id(limit)
|
||||||
|
|
||||||
|
|
||||||
class TestRateLimit(utils.TestCase):
|
class TestRateLimit(utils.TestCase):
|
||||||
|
@ -12,7 +12,7 @@ fasteners==0.7.0
|
|||||||
fixtures==3.0.0
|
fixtures==3.0.0
|
||||||
flake8==2.5.5
|
flake8==2.5.5
|
||||||
future==0.16.0
|
future==0.16.0
|
||||||
hacking==0.12.0
|
hacking==2.0.0
|
||||||
idna==2.6
|
idna==2.6
|
||||||
iso8601==0.1.11
|
iso8601==0.1.11
|
||||||
jsonschema==2.6.0
|
jsonschema==2.6.0
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# process, which may cause wedges in the gate later.
|
# process, which may cause wedges in the gate later.
|
||||||
# Hacking already pins down pep8, pyflakes and flake8
|
# Hacking already pins down pep8, pyflakes and flake8
|
||||||
|
|
||||||
hacking>=1.1.0,<1.2.0 # Apache-2.0
|
hacking>=2.0.0 # Apache-2.0
|
||||||
coverage!=4.4,>=4.0 # Apache-2.0
|
coverage!=4.4,>=4.0 # Apache-2.0
|
||||||
ddt>=1.0.1 # MIT
|
ddt>=1.0.1 # MIT
|
||||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||||
|
@ -71,5 +71,6 @@ def main(argv):
|
|||||||
install.install_dependencies()
|
install.install_dependencies()
|
||||||
print_help(project, venv, root)
|
print_help(project, venv, root)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main(sys.argv)
|
main(sys.argv)
|
||||||
|
2
tox.ini
2
tox.ini
@ -104,7 +104,7 @@ commands = {[testenv:functional]commands}
|
|||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
show-source = True
|
show-source = True
|
||||||
ignore = H404,H405,E122,E123,E128,E251
|
ignore = H404,H405,E122,E123,E128,E251,W504
|
||||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
|
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
|
||||||
|
|
||||||
[testenv:lower-constraints]
|
[testenv:lower-constraints]
|
||||||
|
Loading…
Reference in New Issue
Block a user