Fix parameterized class decorator

The decorator use the types.MethodType to attach the parameterized
test to the test class, but the function changed in python 3.x. This
uses six to do the right thing so this can be used outside the tempest
tests that are always run with python 2.x.

Change-Id: I56fee078d3fa718536208fd3bd5228cc45d24444
This commit is contained in:
Eric Larson 2016-05-06 09:14:57 -05:00
parent 20b5c13fca
commit 281b4f9f2e
1 changed files with 2 additions and 2 deletions

View File

@ -16,8 +16,8 @@ limitations under the License.
import collections
import functools
import time
import types
import six
import netaddr
@ -59,7 +59,7 @@ def parameterized_class(cls):
# To add a method to a class, available for all instances:
# MyClass.method = types.MethodType(f, None, MyClass)
setattr(cls, new_name, types.MethodType(new_method, None, cls))
setattr(cls, new_name, six.create_unbound_method(new_method, cls))
return cls