[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [bridgedb/develop] Fix metaclass definition
commit 215fa51bada924ed54702c6670c42307c967705f
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Fri Jan 10 15:55:51 2020 -0800
Fix metaclass definition
Following the metaclass example prescribed by this module...
https://docs.python.org/3/library/abc.html
This fixes...
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/twisted/trial/runner.py", line 823, in loadByName
return self.suiteFactory([self.findByName(name, recurse=recurse)])
File "/usr/local/lib/python3.5/dist-packages/twisted/trial/runner.py", line 702, in findByName
__import__(name)
File "/home/atagar/Desktop/tor/bridgedb/bridgedb/test/test_email_distributor.py", line 32, in <module>
from bridgedb.test.util import generateFakeBridges
File "/home/atagar/Desktop/tor/bridgedb/bridgedb/test/util.py", line 236, in <module>
TestCaseMixin.register(unittest.TestCase)
builtins.AttributeError: type object 'mixin' has no attribute 'register'
Few more passing tests...
before: FAILED (skips=2, failures=7, errors=154, successes=351)
after: FAILED (skips=6, failures=9, errors=191, successes=359)
---
bridgedb/util.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/bridgedb/util.py b/bridgedb/util.py
index 63f508e..eb20ce7 100644
--- a/bridgedb/util.py
+++ b/bridgedb/util.py
@@ -360,7 +360,7 @@ class JustifiedLogFormatter(logging.Formatter):
return super(JustifiedLogFormatter, self).format(record)
-class mixin:
+class mixin(metaclass=abc.ABCMeta):
"""Subclasses of me can be used as a mixin class by registering another
class, ``ClassA``, which should be mixed with the ``mixin`` subclass, in
order to provide simple, less error-prone, multiple inheritance models::
@@ -407,4 +407,3 @@ class mixin:
.. info:: This class' name is lowercased because pylint is hardcoded to
expect mixin classes to end in ``'mixin'``.
"""
- __metaclass__ = abc.ABCMeta
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits