diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 00000000..d3c22481 --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,9 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. +sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD +sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD +oslosphinx>=4.7.0 # Apache-2.0 +openstackdocstheme>=1.18.1 # Apache-2.0 +oslotest>=3.2.0 # Apache-2.0 +reno>=2.5.0 # Apache-2.0 diff --git a/lower-constraints.txt b/lower-constraints.txt index 9d63ab0e..490e2b32 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -3,10 +3,12 @@ coverage==4.0 decorator==4.3.0 eventlet==0.24.1 fixtures==3.0.0 +flake8==2.6.2 flake8-import-order==0.12 -hacking==0.12.0 +hacking>=1.1.0 # Apache-2.0 mock==2.0.0 netaddr==0.7.18 +openstackdocstheme==1.18.1 oslo.i18n==3.15.3 oslo.log==3.36.0 oslo.serialization==2.28.1 @@ -20,7 +22,7 @@ pylint==1.7.1 reno==2.5.0 requests-mock==1.2.0 six==1.10.0 -Sphinx==1.6.5 +sphinx==1.6.5 stestr==1.0.0 tempest==17.1.0 tenacity==4.9.0 diff --git a/test-requirements.txt b/test-requirements.txt index 70393fbf..7dc4d8fa 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,21 +2,19 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 +hacking>=1.1.0 # Apache-2.0 +bandit!=1.6.0,>=1.1.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.00 fixtures>=3.0.0 # Apache-2.0/BSD flake8-import-order==0.12 # LGPLv3 mock>=2.0.0 # BSD python-subunit>=1.0.0 # Apache-2.0/BSD -sphinx!=1.6.6,!=1.6.7,>=1.6.5 # BSD oslotest>=3.2.0 # Apache-2.0 stestr>=1.0.0 # Apache-2.0 testresources>=2.0.0 # Apache-2.0/BSD testtools>=2.2.0 # MIT testscenarios>=0.4 # Apache-2.0/BSD -reno>=2.5.0 # Apache-2.0 -bandit>=1.1.0 # Apache-2.0 tempest>=17.1.0 # Apache-2.0 pylint==1.7.6 # GPLv2 requests-mock>=1.2.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index 65409409..cc965a18 100644 --- a/tox.ini +++ b/tox.ini @@ -80,17 +80,21 @@ commands = {posargs} [testenv:docs] basepython = python3 -commands = sphinx-build -W -b html doc/source doc/build/html +deps = -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} + -r{toxinidir}/doc/requirements.txt +commands = sphinx-build -b html doc/source doc/build/html [flake8] # E125 continuation line does not distinguish itself from next logical line # E129 visually indented line with same indent as next logical line +# E741 ambiguous variable name # N530 direct neutron imports not allowed +# W504 line break after binary operator # N531 translations hints -ignore = N530,E125,E129,N531 +ignore = N530,E125,E129,E741,N531,W504 show-source = true builtins = _ -exclude = build,dist +exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,.ropeproject import-order-style = pep8 [hacking] @@ -108,4 +112,5 @@ basepython = python3 deps = -c{toxinidir}/lower-constraints.txt -r{toxinidir}/test-requirements.txt + -r{toxinidir}/doc/requirements.txt -r{toxinidir}/requirements.txt diff --git a/vmware_nsxlib/tests/unit/v3/test_load_balancer.py b/vmware_nsxlib/tests/unit/v3/test_load_balancer.py index 2ad6d282..9fe6aced 100644 --- a/vmware_nsxlib/tests/unit/v3/test_load_balancer.py +++ b/vmware_nsxlib/tests/unit/v3/test_load_balancer.py @@ -161,11 +161,10 @@ class TestClientSslProfile(nsxlib_testcase.NsxClientTestCase): 'tags': consts.FAKE_TAGS } with mock.patch.object(self.nsxlib.client, 'create') as create: - self.nsxlib.load_balancer.client_ssl_profile.create( - body['display_name'], body['description'], - consts.FAKE_TAGS) - create.assert_called_with('loadbalancer/client-ssl-profiles', - body) + self.nsxlib.load_balancer.client_ssl_profile.create( + body['display_name'], body['description'], + consts.FAKE_TAGS) + create.assert_called_with('loadbalancer/client-ssl-profiles', body) def test_list_client_ssl_profiles(self): with mock.patch.object(self.nsxlib.client, 'list') as list_call: @@ -200,11 +199,10 @@ class TestServerSslProfile(nsxlib_testcase.NsxClientTestCase): 'tags': consts.FAKE_TAGS } with mock.patch.object(self.nsxlib.client, 'create') as create: - self.nsxlib.load_balancer.server_ssl_profile.create( - body['display_name'], body['description'], - consts.FAKE_TAGS) - create.assert_called_with('loadbalancer/server-ssl-profiles', - body) + self.nsxlib.load_balancer.server_ssl_profile.create( + body['display_name'], body['description'], + consts.FAKE_TAGS) + create.assert_called_with('loadbalancer/server-ssl-profiles', body) def test_list_server_ssl_profiles(self): with mock.patch.object(self.nsxlib.client, 'list') as list_call: @@ -278,11 +276,11 @@ class TestPool(nsxlib_testcase.NsxClientTestCase): 'tags': consts.FAKE_TAGS } with mock.patch.object(self.nsxlib.client, 'create') as create: - self.nsxlib.load_balancer.pool.create( - body['display_name'], body['description'], - consts.FAKE_TAGS, algorithm=body['algorithm']) - create.assert_called_with('loadbalancer/pools', - body) + self.nsxlib.load_balancer.pool.create( + body['display_name'], body['description'], + consts.FAKE_TAGS, algorithm=body['algorithm']) + create.assert_called_with('loadbalancer/pools', + body) def test_list_pools(self): with mock.patch.object(self.nsxlib.client, 'list') as list_call: @@ -359,12 +357,12 @@ class TestVirtualServer(nsxlib_testcase.NsxClientTestCase): 'tags': consts.FAKE_TAGS } with mock.patch.object(self.nsxlib.client, 'create') as create: - self.nsxlib.load_balancer.virtual_server.create( - body['display_name'], body['description'], - consts.FAKE_TAGS, ip_protocol=body['ip_protocol'], - port=body['port'], enabled=body['enabled']) - create.assert_called_with('loadbalancer/virtual-servers', - body) + self.nsxlib.load_balancer.virtual_server.create( + body['display_name'], body['description'], + consts.FAKE_TAGS, ip_protocol=body['ip_protocol'], + port=body['port'], enabled=body['enabled']) + create.assert_called_with('loadbalancer/virtual-servers', + body) def test_list_virtual_servers(self): with mock.patch.object(self.nsxlib.client, 'list') as list_call: @@ -503,12 +501,12 @@ class TestService(nsxlib_testcase.NsxClientTestCase): 'tags': consts.FAKE_TAGS } with mock.patch.object(self.nsxlib.client, 'create') as create: - self.nsxlib.load_balancer.service.create( - body['display_name'], body['description'], - consts.FAKE_TAGS, enabled=body['enabled'], - attachment=body['attachment']) - create.assert_called_with('loadbalancer/services', - body) + self.nsxlib.load_balancer.service.create( + body['display_name'], body['description'], + consts.FAKE_TAGS, enabled=body['enabled'], + attachment=body['attachment']) + create.assert_called_with('loadbalancer/services', + body) def test_list_services(self): with mock.patch.object(self.nsxlib.client, 'list') as list_call: diff --git a/vmware_nsxlib/v3/client_cert.py b/vmware_nsxlib/v3/client_cert.py index 3bd4a4d4..67455fa8 100644 --- a/vmware_nsxlib/v3/client_cert.py +++ b/vmware_nsxlib/v3/client_cert.py @@ -181,7 +181,7 @@ class ClientCertificateManager(object): try: self._storage_driver.delete_cert(self._identity) - except Exception: + except Exception as e: LOG.error("Failed to clear certificate in storage: %s", e) ok = False diff --git a/vmware_nsxlib/v3/cluster.py b/vmware_nsxlib/v3/cluster.py index aad190aa..425f467d 100644 --- a/vmware_nsxlib/v3/cluster.py +++ b/vmware_nsxlib/v3/cluster.py @@ -282,7 +282,7 @@ class NSXRequestsHTTPProvider(AbstractHTTPProvider): else: for header_name in resp.headers: if self.SET_COOKIE_FIELD.lower() == header_name.lower(): - m = re.match('%s=.*?\;' % self.JSESSIONID, + m = re.match('%s=.*?\;' % self.JSESSIONID, # noqa resp.headers[header_name]) if m: session.default_headers[self.COOKIE_FIELD] = (