From the error, it looks like it is actually executing newevent.NewCommandEvent()
, so I assume that somewhere in your code you have a top-level line something like this:
import wx.lib.newevent
...
event, binder = wx.lib.newevent.NewCommandEvent()
When autodoc imports the module, it tries to run this line of code, but since NewCommandEvent
is actually a Mock
object, Python can't bind its output to the (event, binder)
tuple. There are two possible solutions. The first is to change your code to that this is not executed on import, maybe by wrapping it inside if __name__ == '__main__'
. I would recommend this solution because creating objects like this on import can often have preblematic side effects.
The second solution is to tell the Mock
object to return appropriate values thus:
wx.lib.newevent.NewCommandEvent = mock.Mock(return_value=(Mock(), Mock()))
However, if you are doing anything in your code with the returned values you might run into the same problem further down the line.