summaryrefslogtreecommitdiff
path: root/pytest.py
diff options
context:
space:
mode:
authorRémi Cardona <remi.cardona@free.fr>2014-07-17 00:45:50 +0200
committerRémi Cardona <remi.cardona@free.fr>2014-07-17 00:45:50 +0200
commit24fd6fca2f119662ea9acc9b6f787349a7912ab1 (patch)
tree4c4fc0bc039aecd106fa2cff6a79d2f8d171e264 /pytest.py
parent2b4e8cb6b0637a2953c8cf5cba6a5bce2b79eb2a (diff)
downloadlogilab-common-24fd6fca2f119662ea9acc9b6f787349a7912ab1.tar.gz
Only read/write func.__name__ and class.__self__
Since at least python 2.0, func_name and __name__ point to the same struct member and since 2.4, they share the exact same getter and setter. Since __name__ is the only property left in python 3.0, let's use that one. As for method.__self__, it has been available since at least python 2.0 too.
Diffstat (limited to 'pytest.py')
-rw-r--r--pytest.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/pytest.py b/pytest.py
index 0e3bfea..f94db7a 100644
--- a/pytest.py
+++ b/pytest.py
@@ -886,14 +886,13 @@ class SkipAwareTextTestRunner(unittest.TextTestRunner):
else:
if isinstance(test, testlib.TestCase):
meth = test._get_test_method()
- func = meth.im_func
- testname = '%s.%s' % (meth.im_class.__name__, func.__name__)
+ testname = '%s.%s' % (test.__name__, meth.__name__)
elif isinstance(test, types.FunctionType):
func = test
testname = func.__name__
elif isinstance(test, types.MethodType):
- func = test.im_func
- testname = '%s.%s' % (test.im_class.__name__, func.__name__)
+ cls = test.__self__.__class__
+ testname = '%s.%s' % (cls.__name__, test.__name__)
else:
return True # Not sure when this happens
if isgeneratorfunction(test) and skipgenerator: