diff options
author | Rémi Cardona <remi.cardona@free.fr> | 2014-07-17 00:45:50 +0200 |
---|---|---|
committer | Rémi Cardona <remi.cardona@free.fr> | 2014-07-17 00:45:50 +0200 |
commit | 24fd6fca2f119662ea9acc9b6f787349a7912ab1 (patch) | |
tree | 4c4fc0bc039aecd106fa2cff6a79d2f8d171e264 /pytest.py | |
parent | 2b4e8cb6b0637a2953c8cf5cba6a5bce2b79eb2a (diff) | |
download | logilab-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.py | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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: |