I created the empty abstract class AbstractStorage
and inherited the Storage
class from it:
import abc
import pymongo as mongo
hos
This isn't really a problem with ABCs, it's a problem with PyMongo. There is an issue about it here. It seems that pymongo overrides __getattr__
to return some sort of database class. This means that host.__isabstractmethod__
returns a Database object, which is true in a boolean context. This cause ABCMeta to believe that host
is an abstract method:
>>> bool(host.__isabstractmethod__)
True
The workaround described in the issue report is to manually set host.__isabstractmethod__ = False
on your object. The last comment on the issue suggests a fix has been put in for pymongo 3.0.