Skip to content
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

Failing to mock duplicity._librsync #2387

Closed
kwloafman opened this issue Aug 26, 2016 · 4 comments
Closed

Failing to mock duplicity._librsync #2387

kwloafman opened this issue Aug 26, 2016 · 4 comments

Comments

@kwloafman
Copy link

kwloafman commented Aug 26, 2016

Details

Expected Result

Successful dummy import of duplicity._librsync

Actual Result

import of still fails.

I tried the example in your FAQ. It works with lockfile, but does not work with a nested module. duplicity needs to remain imported, just to dummy out _librsync, without changing the code of librsync if possible. I have read the answers on the net, but none of them seem to involve mocking out a complete submodule. Is that even possible?

...Thanks,
...Ken

@kwloafman
Copy link
Author

Just to follow up, I have tried mocking with:

  • _librsync
  • duplicity._librsync
  • duplicity.librsync._librsync

separately and together. I have tried the autodoc_mock_imports option on the above as well. I've used mock.Mock() and mock.MagicMock() in combination with above to no success. Can anyone point me to an answer that works on the net?

I think I have gone through all of the bogus ones mentioning [python, mock, package, module] and tried them all with no luck. There are a lot of answers out there, but ferreting out the real answers seems to be impossible.

@humitos humitos added the Support Support question label Mar 9, 2017
@humitos
Copy link
Member

humitos commented Mar 9, 2017

I think there are no a generic solution for this. The one listed in the FAQ seems to be one that works in the most common cases but there are some libraries that requires more research. pygame is one of them as listed in #2511 (comment) and this one is another special case.

Please, if you find the solution share it here.

@kwloafman
Copy link
Author

kwloafman commented Mar 9, 2017 via email

@humitos
Copy link
Member

humitos commented Mar 9, 2017

Thank you a lot. Since the issue is solved I'm closing this one. Feel free to reopen it if you have any issue.

@humitos humitos closed this as completed Mar 9, 2017
@ghost ghost removed the Support Support question label Mar 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants