Instead of using the "autodoc_mock_imports" in the conf.py I "manually 
mocked" the PySide classes. Now the documentation is generating for classes 
that extends the PySide.

import mock
sys.modules['PySide2'] = mock.Mock(QtWidgets=object)

One downside to this is that the base class will be object if we 
use :show-inheritance: in the .rst files. 

// Johan


On Tuesday, November 14, 2017 at 2:32:00 PM UTC+1, johan Borgström wrote:
>
> Hi Justin,
>
> I am building a custom model and the class is extending QtCore.QObject
> The reason I extend QObject is to be able to emit a signal. In this case 
> it can probably be done with composition instead of inheritance. But in 
> some other cases I am extending PySide classes and I would like to keep it 
> this way. So I want to document "my implementation" of the PySide classes, 
> can I do this? 
>
> Best,
> Johan
>
> On Monday, November 13, 2017 at 7:26:35 PM UTC+1, Justin Israel wrote:
>>
>>
>>
>> On Tue, Nov 14, 2017, 6:01 AM johan Borgström <[email protected]> 
>> wrote:
>>
>>> Hi,
>>>
>>> I am testing Sphinx and the autodoc feature. It seems like no 
>>> documentation is generated when a class is extending a mocked module. (In 
>>> my conf.py i am using autodoc_mock_imports = ['pymel', 'pyside2'])
>>>
>>> Does anyone have any tips for generating docs for mocked modules?
>>>
>>
>> I've seen the same behaviour when I mock objects, but I usually do that 
>> because they aren't available during the doc gen process and they aren't 
>> objects I would want included in my docs anyways. 
>> I'm curious, what kind of objects would you need to mock but also want to 
>> document? If they are mocked it implies they aren't available, which means 
>> neither are the docstrings or signatures of those objects. 
>>
>>
>>> Best,
>>> Johan
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Python Programming for Autodesk Maya" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/python_inside_maya/fea21276-740f-4a55-849b-c9ec1efcd222%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/python_inside_maya/fea21276-740f-4a55-849b-c9ec1efcd222%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/17e577ca-efd8-4ded-8563-de1b5207dc34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to