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

Package-wide Import testing outside of __init__.py #62

Open
TheChymera opened this issue Mar 21, 2018 · 0 comments
Open

Package-wide Import testing outside of __init__.py #62

TheChymera opened this issue Mar 21, 2018 · 0 comments

Comments

@TheChymera
Copy link
Member

Curently, we are testing if all imports work by including this snippet in all modules' __init__.py.

This is quite annoying, since it loads all imports from a module even only if you are only looking to execute one function, and thus raises (perfectly sensible but command-unrelated) ImportErrors, e.g.:

/home/chymera/src/SAMRI/samri/plotting/connectivity.py:5: UserWarning: 
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

The backend was *originally* set to u'GTK3Agg' by the following code:
  File "drp_activity.py", line 5, in <module>
    import matplotlib.pyplot as plt
  File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 69, in <module>
    from matplotlib.backends import pylab_setup
  File "/usr/lib64/python2.7/site-packages/matplotlib/backends/__init__.py", line 14, in <module>
    line for line in traceback.format_stack()


  matplotlib.use('Agg')
Traceback (most recent call last):
  File "drp_activity.py", line 6, in <module>
    import samri.plotting.maps as maps
  File "/home/chymera/src/SAMRI/samri/plotting/__init__.py", line 6, in <module>
    module = loader.find_module(module_name).load_module(module_name)
  File "/usr/lib64/python2.7/pkgutil.py", line 246, in load_module
    mod = imp.load_module(fullname, self.file, self.filename, self.etc)
  File "/home/chymera/src/SAMRI/samri/plotting/summary.py", line 19, in <module>
    from samri.report.utilities import add_pattern_data
  File "/home/chymera/src/SAMRI/samri/report/__init__.py", line 6, in <module>
    module = loader.find_module(module_name).load_module(module_name)
  File "/usr/lib64/python2.7/pkgutil.py", line 246, in load_module
    mod = imp.load_module(fullname, self.file, self.filename, self.etc)
  File "/home/chymera/src/SAMRI/samri/report/aggregate.py", line 10, in <module>
  File "/home/chymera/src/SAMRI/samri/pipelines/__init__.py", line 6, in <module>
    module = loader.find_module(module_name).load_module(module_name)
  File "/usr/lib64/python2.7/pkgutil.py", line 246, in load_module
    mod = imp.load_module(fullname, self.file, self.filename, self.etc)
  File "/home/chymera/src/SAMRI/samri/pipelines/preprocess.py", line 22, in <module>
    from bids.grabbids import BIDSLayout
ImportError: No module named bids.grabbids
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

1 participant