diff options
author | Stephan Richter <stephan.richter@gmail.com> | 2019-05-12 12:17:41 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2019-06-10 17:15:32 -0400 |
commit | c399478e86892f0e7ade51873dfbe13f87ecfa83 (patch) | |
tree | fb57f3945c364c35be7ffcb1fedfa1314be58104 /coverage | |
parent | e1574b260db45ec00074c1d9aafc3586cb3952a0 (diff) | |
download | python-coveragepy-git-c399478e86892f0e7ade51873dfbe13f87ecfa83.tar.gz |
Support for full qnames for old-style classes.
Diffstat (limited to 'coverage')
-rw-r--r-- | coverage/context.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/coverage/context.py b/coverage/context.py index fb1b76ac..d2f75db2 100644 --- a/coverage/context.py +++ b/coverage/context.py @@ -78,5 +78,19 @@ def qualname_from_frame(frame): qname = cls.__module__ + '.' + cls.__name__ + "." + fname break else: - qname = func.__module__ + '.' + fname + # Support for old-style classes. + def mro(bases): + for base in bases: + f = base.__dict__.get(fname, None) + if f is func: + return base.__module__ + '.' + base.__name__ + "." + fname + for base in bases: + qname = mro(base.__bases__) + if qname is not None: + return qname + return None + qname = mro([self.__class__]) + if qname is None: + qname = func.__module__ + '.' + fname + return qname |