Skip to content

Commit

Permalink
re-enable mock, add wintypes to it
Browse files Browse the repository at this point in the history
  • Loading branch information
maphew committed Jun 21, 2015
1 parent 2920784 commit 5a90771
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
24 changes: 12 additions & 12 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
import shlex

# https://read-the-docs.readthedocs.org/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules
#try:
#py3 import
# from unittest.mock import MagicMock
#except ImportError:
#py27 import
# from mock import Mock as MagicMock
try:
py3 import
from unittest.mock import MagicMock
except ImportError:
py27 import
from mock import Mock as MagicMock

#class Mock(MagicMock):
# @classmethod
# def __getattr__(cls, name):
# return Mock()
class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return Mock()

#MOCK_MODULES = ['ctypes']
#sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
MOCK_MODULES = ['ctypes', 'wintypes']
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down
8 changes: 2 additions & 6 deletions docs/source/index.rst.leo
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<vnodes>
<v t="maphew.20150613204824.4"><vh>@persistence</vh>
<v t="maphew.20150613204824.5" a="E"><vh>@data:@auto conf.py</vh>
<v t="maphew.20150619234753.3"><vh>@gnxs</vh></v>
<v t="maphew.20150620221605.2"><vh>@gnxs</vh></v>
</v>
</v>
<v t="maphew.20150601230033.5" a="E"><vh>Apt - Read The Docs</vh>
Expand All @@ -27,12 +27,8 @@
<t tx="maphew.20150613204824.4"></t>
<t tx="maphew.20150613204824.5">gnx: maphew.20150613204824.2
</t>
<t tx="maphew.20150619234753.3">gnx: maphew.20150613204824.3
<t tx="maphew.20150620221605.2">gnx: maphew.20150613204824.3
unl: conf declarations
gnx: maphew.20150619234753.1
unl: class Mock
gnx: maphew.20150619234753.2
unl: class Mock--&gt;__getattr__
</t>
</tnodes>
</leo_file>
2 changes: 1 addition & 1 deletion knownpaths.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import sys
import ctypes
try:

from ctypes import windll, wintypes
except ImportError, ValueError:
# catch ImportError and ValueError due to issue16396
# http://bugs.python.org/issue16396
pass

from uuid import UUID

class GUID(ctypes.Structure): # [1]
_fields_ = [
("Data1", wintypes.DWORD),
Expand Down

0 comments on commit 5a90771

Please sign in to comment.