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

TST - skip doctest when matplotlib is not available #58

Merged
merged 1 commit into from Aug 13, 2012

Conversation

MrBago
Copy link
Contributor

@MrBago MrBago commented Aug 13, 2012

It seems like somebody has already solved this problem for us. This will replace #57

@travisbot
Copy link

This pull request fails (merged 9b070e5 into 38c1ec1).

has_mpl=False
hot = None
plt = None
matplotlib, has_mpl, setup_module = optional_package("matplotlib")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can just import matplotlib.pyplot -- matplotlib.pyplot.cm.hot is the colormap we use later.

@stefanv
Copy link
Contributor

stefanv commented Aug 13, 2012

So, the question is whether these errors should be raised on import or on first use.

Previously, this was a much bigger problem, but since we now require explicit imports of submodules it's probably not so bad. Still, I think it's better to do it on first use. E.g., I want to be able to use matplotlib-reliant functions, even if Mayavi is not installed.

@MrBago
Copy link
Contributor Author

MrBago commented Aug 13, 2012

That's exactly what optional import does. If the import fails, it creates a TripWire instead. The first time someone tries to use the missing module or package an error is raised. I thought I would need to make a decorator to tell nose to skip the tests when the imports fail, but Matthew has already taken care of that too.

@stefanv
Copy link
Contributor

stefanv commented Aug 13, 2012

Excellent, now I understand the TripWire concept too :)

stefanv added a commit that referenced this pull request Aug 13, 2012
TST - skip doctest when matplotlib is not available
@stefanv stefanv merged commit 8e3e953 into dipy:master Aug 13, 2012
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

Successfully merging this pull request may close these issues.

None yet

5 participants