From ee2c0bb83251e77c45149d53dd8fffd9e7ba43f7 Mon Sep 17 00:00:00 2001 From: Bryce Lampe Date: Wed, 27 Jun 2012 12:41:47 -0700 Subject: [PATCH] fix 2.7.3 compatibility --- testify/test_case.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/testify/test_case.py b/testify/test_case.py index e801e9b3..10a99323 100644 --- a/testify/test_case.py +++ b/testify/test_case.py @@ -220,11 +220,11 @@ def __init_fixture_methods(self): method = fixture_decorator(method) # collect all of our fixtures in appropriate buckets - if self.is_fixture_method(method): + if self.is_fixture_method(getattr(method, '__func__', None)): # where in our MRO this fixture was defined - method._defining_class_depth = reverse_mro_list.index(defining_class) + method.__func__._defining_class_depth = reverse_mro_list.index(defining_class) # we grabbed this from the class and need to bind it to us - instance_method = instancemethod(method, self) + instance_method = instancemethod(method.__func__, self) self._fixture_methods[method._fixture_type].append(instance_method) # arrange our fixture buckets appropriately @@ -586,6 +586,9 @@ class hierarchy, since base classes (and their methods!) are created before """ def fixture_decorator(function): + if inspect.ismethod(function): + function = function.__func__ + # record the fixture type and id for this function function._fixture_type = fixture_type