From 5a90771067d9f363d12548e323e0b7e85da588ba Mon Sep 17 00:00:00 2001 From: Matt Wilkie Date: Sat, 20 Jun 2015 22:19:21 -0700 Subject: [PATCH] re-enable mock, add `wintypes` to it #48 --- docs/source/conf.py | 24 ++++++++++++------------ docs/source/index.rst.leo | 8 ++------ knownpaths.py | 2 +- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index c24d25a..2f4ecd3 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -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 diff --git a/docs/source/index.rst.leo b/docs/source/index.rst.leo index effc123..054fd30 100644 --- a/docs/source/index.rst.leo +++ b/docs/source/index.rst.leo @@ -12,7 +12,7 @@ @persistence @data:@auto conf.py -@gnxs +@gnxs Apt - Read The Docs @@ -27,12 +27,8 @@ gnx: maphew.20150613204824.2 -gnx: maphew.20150613204824.3 +gnx: maphew.20150613204824.3 unl: conf declarations -gnx: maphew.20150619234753.1 -unl: class Mock -gnx: maphew.20150619234753.2 -unl: class Mock-->__getattr__ diff --git a/knownpaths.py b/knownpaths.py index 8ebfa69..a9b9e24 100644 --- a/knownpaths.py +++ b/knownpaths.py @@ -4,7 +4,6 @@ import sys import ctypes try: - from ctypes import windll, wintypes except ImportError, ValueError: # catch ImportError and ValueError due to issue16396 @@ -12,6 +11,7 @@ pass from uuid import UUID + class GUID(ctypes.Structure): # [1] _fields_ = [ ("Data1", wintypes.DWORD),