Skip to content

BF(workaround): skip test_diff if hypothesis is not importable #675

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions nibabel/tests/test_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
from os.path import (dirname, join as pjoin, abspath)
import numpy as np

from hypothesis import given
import hypothesis.strategies as st

try:
import hypothesis
from hypothesis import given
import hypothesis.strategies as st
except Exception as exc:
from nose import SkipTest
raise SkipTest("Failed to import hypothesis or its components: %s" % exc)
Copy link
Member

Choose a reason for hiding this comment

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

To avoid necessarily skipping the entire file, what about making this except statement:

except ImportError:
    class st(object):
        @classmethod
        def data(klass):
            return None

    def given(obj):
        def decorator(func):
            def null_test():
                return None
        return decorator

Maybe raise a warning, as well.


DATA_PATH = abspath(pjoin(dirname(__file__), 'data'))

Expand Down