From 72e154e7d01078c145215bad63f45cb8cb4a8069 Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Wed, 7 Jun 2017 01:36:44 -0700 Subject: [PATCH] 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 --- .../test/integration_tests/pages/navigation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openstack_dashboard/test/integration_tests/pages/navigation.py b/openstack_dashboard/test/integration_tests/pages/navigation.py index b5369baf47..66ba8323fa 100644 --- a/openstack_dashboard/test/integration_tests/pages/navigation.py +++ b/openstack_dashboard/test/integration_tests/pages/navigation.py @@ -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