PyQt 4 import in read-the-docs

孤人 提交于 2019-12-05 16:07:07

I had a similar problem with PyQt5/py3 (a metaclass conflict with MagickMock). My workaround is to manually mock the module in conf.py instead of using unittest.mock:

class PyQt5:
    @staticmethod
    def qVersion():
        return '5.0.0'
    class QtCore:
        class QObject:
            pass
    # etc...
sys.modules['PyQt5'] = PyQt5

This makes the import / metaclass conflict problem disappear. Unfortunately autodoc still doesn't work (no output), though the builds pass...

Tedious of course.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!