Skip to content

Commit

Permalink
fix 2.7.3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
blampe committed Jun 27, 2012
1 parent 421f400 commit ee2c0bb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions testify/test_case.py
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit ee2c0bb

Please sign in to comment.