Created
December 4, 2014 23:14
-
-
Save abondis/baa51b71710019db89c5 to your computer and use it in GitHub Desktop.
mock flask.ext.restul.Resource heritance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mock import MagicMock, patch | |
import sys | |
restful = MagicMock(autospec=True) | |
attrs = {'__init__': lambda *args, **kwargs: None} | |
bases = (object,) | |
Res = type('Resource', bases, attrs) | |
restful.Resource = Res | |
with patch.dict( | |
'sys.modules', | |
{'flask.ext.restful': restful, | |
} | |
): | |
from truc import chose # c'est la que flask.ext.restful.Resource -> A(Resource) -> B(A) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment