enable H237 check
Remove the remove use of 'new' module by properly patching the instance object. Additionally, enable the H237 (module is removed in Python 3) check Change-Id: I7407600478de218a4294c4bfd774cd4cf7e1741e Partial-Bug: 1329017
This commit is contained in:
parent
e8b8340464
commit
d884f30e57
|
@ -13,7 +13,6 @@
|
|||
# under the License.
|
||||
|
||||
import httplib
|
||||
import new
|
||||
import random
|
||||
|
||||
import eventlet
|
||||
|
@ -106,16 +105,19 @@ class ApiRequestEventletTest(base.BaseTestCase):
|
|||
self.assertTrue(self.req._handle_request.called)
|
||||
|
||||
def test_run_and_timeout(self):
|
||||
def my_handle_request(self):
|
||||
LOG.info('my_handle_request() self: %s' % self)
|
||||
LOG.info('my_handle_request() dir(self): %s' % dir(self))
|
||||
def my_handle_request():
|
||||
LOG.info('my_handle_request() self: %s' % self.req)
|
||||
LOG.info('my_handle_request() dir(self): %s' % dir(self.req))
|
||||
eventlet.greenthread.sleep(REQUEST_TIMEOUT * 2)
|
||||
|
||||
self.req._request_timeout = REQUEST_TIMEOUT
|
||||
self.req._handle_request = new.instancemethod(
|
||||
my_handle_request, self.req, request.EventletApiRequest)
|
||||
self.req.start()
|
||||
self.assertIsNone(self.req.join())
|
||||
with mock.patch.object(
|
||||
self.req,
|
||||
'_handle_request',
|
||||
new=my_handle_request
|
||||
):
|
||||
self.req._request_timeout = REQUEST_TIMEOUT
|
||||
self.req.start()
|
||||
self.assertIsNone(self.req.join())
|
||||
|
||||
def prep_issue_request(self):
|
||||
mysock = mock.Mock()
|
||||
|
|
4
tox.ini
4
tox.ini
|
@ -65,8 +65,6 @@ commands = python setup.py build_sphinx
|
|||
# E128 continuation line under-indented for visual indent
|
||||
# E129 visually indented line with same indent as next logical line
|
||||
# E265 block comment should start with ‘# ‘
|
||||
# H104 file contains nothing but comments
|
||||
# H237 module is removed in Python 3
|
||||
# H305 imports not grouped correctly
|
||||
# H307 like imports should be grouped together
|
||||
# H401 docstring should not start with a space
|
||||
|
@ -74,7 +72,7 @@ commands = python setup.py build_sphinx
|
|||
# H405 multi line docstring summary not separated with an empty line
|
||||
# H904 Wrap long lines in parentheses instead of a backslash
|
||||
# TODO(marun) H404 multi line docstring should start with a summary
|
||||
ignore = E125,E126,E128,E129,E265,H237,H305,H307,H401,H402,H404,H405,H904
|
||||
ignore = E125,E126,E128,E129,E265,H305,H307,H401,H402,H404,H405,H904
|
||||
show-source = true
|
||||
builtins = _
|
||||
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios
|
||||
|
|
Loading…
Reference in New Issue