-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Replace hand-written Mock-class with unittest.mock.MagickMock
in the FAQ trick for 'autodoc`
#865
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sounds like a good idea. Is this backported to 2.x do you know? |
unittest.mock in Python 3.3 is the same as the mock package from PyPI, which works for all relevant Python versions. |
Cool. Would happily merge this if a PR was sent. Working on some other stuff today, but it sounds like a win. |
… mocking modules with C-libs.
#865: Use MagickMock class in the FAQ's exemplary code for mocking modul...
Please do not merge my request, it has a minor error in the python code (MagicKMock instead of MagicMock :-( |
#865: Fix typo in suggested code regarding MagicKMock.
Well, although the MagicMock does a lost things better, it does not "behave" as package, as the class method of the previous code did. So now I believe that i have nailed it:
I' preparing the patch. |
…ed mocking-out of modules with C-libs.
#865: Restore part of the previous behavior on the suggested mocking-out...
Thanks for this :) |
I'm suggesting to improve the exemplary code of the trick needed to make the
autodoc
sphinx-extension work with dependencies needing C-libraries:http://read-the-docs.readthedocs.org/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules
Instead of including a half-baked mock-class why not use the readily
unittest.mock.MagickMock
?That way we get 2 gains:
Here is the code i'm suggesting:
The drawback is that the fix applies only for python 3.3+.1
I can request a merge if instructed on how to explain to the developers the python 3.3+ issue.
The text was updated successfully, but these errors were encountered: