Fixing types.MethodType signature for Python 3.5
The signature for MethodType has changed in Python 3, and the current implementation won't work, to fix this we are replacing it with the py 2/3 compatible python-six equivalent, six.create_unbound_method. http://six.readthedocs.io/#six.create_unbound_method This is causing the Python 3.5 tests to fail for the octavia-dashboard when importing the navigation.py file, throwing the following error. > TypeError: method expected 2 arguments, got 3 The following review to fix the gate for the octavia-dashboard is depending on this patch. https://review.openstack.org/#/c/471611/ This can also be reproduced by simply executing navigation.py using Python 3.5. > python3.5 nagivation.py Change-Id: Iebca15ae962a1aa0825c6ba6d482206531726696
This commit is contained in:
parent
c01c4d9873
commit
72e154e7d0
|
@ -12,7 +12,7 @@
|
|||
|
||||
import importlib
|
||||
import json
|
||||
import types
|
||||
import six
|
||||
|
||||
from selenium.webdriver.common import by
|
||||
|
||||
|
@ -327,7 +327,7 @@ class Navigation(object):
|
|||
@classmethod
|
||||
def _create_go_to_method(cls, path, class_name=None):
|
||||
go_to_method = Navigation.GoToMethodFactory(path, class_name)
|
||||
inst_method = types.MethodType(go_to_method, None, Navigation)
|
||||
inst_method = six.create_unbound_method(go_to_method, Navigation)
|
||||
setattr(Navigation, inst_method.name, inst_method)
|
||||
|
||||
@classmethod
|
||||
|
|
Loading…
Reference in New Issue