Permalink
Browse files

ugly-ass mocking for RTD

  • Loading branch information...
1 parent 0421241 commit f039f54bac50eca69acc06f873496c29984b9bf5 @tyarkoni tyarkoni committed Dec 31, 2014
Showing with 13 additions and 5 deletions.
  1. +10 −2 docs/conf.py
  2. +1 −1 neurosynth/analysis/cluster.py
  3. +2 −2 neurosynth/base/lexparser.py
View
@@ -19,14 +19,22 @@
# ReadTheDocks doesn't support necessary C dependencies (e.g., Atlas), so we
# mock them out per https://docs.readthedocs.org/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules.
-from mock import Mock as MagicMock
+try:
+ from unittest.mock import MagicMock
+except ImportError:
+ from mock import MagicMock
class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return Mock()
-MOCK_MODULES = ['numpy', 'scipy', 'pandas', 'ply', 'scikit-learn', 'nibabel']
+# Ugh.
+MOCK_MODULES = ['numpy', 'scipy', 'pandas', 'ply', 'sklearn', 'nibabel',
+'matplotlib', 'sklearn.feature_selection.univariate_selection',
+'scipy.stats', 'sklearn.feature_selection', 'sklearn.preprocessing',
+'sklearn.metrics', 'sklearn.svm', 'sklearn.ensemble', 'sklearn.dummy',
+'sklearn.grid_search', 'numpy.testing']
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
# If extensions (or modules to document with autodoc) are in another directory,
@@ -14,7 +14,7 @@
from copy import deepcopy
from shutil import copyfile
import simplejson as json
-import matplotlib.pyplot as plt
+from matplotlib import pyplot as plt
logger = logging.getLogger('neurosynth.cluster')
@@ -2,8 +2,8 @@
# ex: set sts=2 ts=2 sw=2 et:
""" Parsing expression grammar for feature-based study selection. """
-import ply.lex as lex
-import ply.yacc as yacc
+from ply import lex
+from ply import yacc
import pandas as pd
import logging

0 comments on commit f039f54

Please sign in to comment.