Sphinx: how to exclude imports in automodule?

前端 未结 3 1413
清歌不尽
清歌不尽 2020-12-03 03:02

I have a Raspberry Pi project written in Python that uses RPi.GPIO module. All the work on the code is done on a Windows box where RPi.GPIO will not install and every time I

3条回答
  •  天涯浪人
    2020-12-03 03:40

    Besides mocking modules, I also had to mock calls that only made sense in my embedded system (for example mocking a call to a function read_reg() from the module examplemod that reads a register from an FPGA via SPI).

    import mox as mox 
    import examplemod
    m = mox.Mox()
    m.StubOutWithMock(examplemod, 'read_reg')
    

    Note that you need python-mox: sudo apt-get install python-mox

    Reference: How to generate sphinx documentation for python code running in an embedded system

提交回复
热议问题