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

Conversation

yarikoptic
Copy link
Member

Apparently hypothesis is quite a tricky beast. It might either fail to install
on elderly systems from source tarball, or even if it is installable, apparently
might rely on some coverage API which is present only in more recent versions
and thus fail upon import.

All those are of relevance for older systems and only for testing.

I know that e.g. #661 would add tests in the test_diff.py which would not even need hypothesis, but I do not see easy way to make it work since hypothesis's given is used as a decorator.

Apparently hypothesis  is quite a tricky beast.  It might either fail to install
on elderly systems from source tarball, or even if it is installable, apparently
might rely on some coverage API which is present only in more recent versions
and thus fail upon import.
All those are of relevance for older systems and only for testing.
@yarikoptic
Copy link
Member Author

worse comes to worse, I could actually just keep this patch in the debian pkg so it would help to avoid some of those on older systems... may be that would actually be better?

@coveralls
Copy link

Coverage Status

Coverage remained the same at 91.826% when pulling b65844d on yarikoptic:bf-opt-hypothesis into 7877add on nipy:master.

@yarikoptic
Copy link
Member Author

Or given all the appveyor difficulties we should just rip appveyor out for now and limit ourselves to just some set of cases?

@codecov-io
Copy link

Codecov Report

Merging #675 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #675   +/-   ##
=======================================
  Coverage   88.86%   88.86%           
=======================================
  Files          93       93           
  Lines       11378    11378           
  Branches     1869     1869           
=======================================
  Hits        10111    10111           
  Misses        930      930           
  Partials      337      337

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7877add...b65844d. Read the comment docs.

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.

@yarikoptic
Copy link
Member Author

#678 prunes use of hypothesis altogether

@yarikoptic yarikoptic closed this Oct 6, 2018
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.

4 participants