Skip to content

Commit

Permalink
Merge branch 'matthew-brett-py35-testing' into maint/0.10.x
Browse files Browse the repository at this point in the history
  • Loading branch information
arokem committed Dec 4, 2015
2 parents 63220c8 + 96399f2 commit ef99b01
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ python:
- 3.2
- 3.3
- 3.4
- 3.5
matrix:
include:
- python: 2.7
Expand Down Expand Up @@ -53,6 +54,8 @@ before_install:
- virtualenv $VENV_ARGS venv
- source venv/bin/activate
- python --version # just to check
# Needed for Python 3.5 wheel fetching
- pip install -U pip
- retry pip install nose;
- wheelhouse_pip_install $DEPENDS;
- if [ "${COVERAGE}" == "1" ]; then
Expand Down Expand Up @@ -82,4 +85,4 @@ script:
fi
- nosetests --with-doctest --verbose $COVER_ARGS dipy
after_success:
- if [ "${COVERAGE}" == "1" ]; then coveralls; fi
- if [ "${COVERAGE}" == "1" ]; then coveralls; fi
29 changes: 29 additions & 0 deletions dipy/utils/tests/test_tripwire.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
""" Testing tripwire module.
"""

from ..tripwire import TripWire, is_tripwire, TripWireError

from nose import SkipTest
from nose.tools import (assert_true, assert_false, assert_raises,
assert_equal, assert_not_equal)


def test_is_tripwire():
assert_false(is_tripwire(object()))
assert_true(is_tripwire(TripWire('some message')))


def test_tripwire():
# Test tripwire object
silly_module_name = TripWire('We do not have silly_module_name')
assert_raises(TripWireError,
getattr,
silly_module_name,
'do_silly_thing')
# Check AttributeError can be checked too
try:
silly_module_name.__wrapped__
except TripWireError as err:
assert_true(isinstance(err, AttributeError))
else:
raise RuntimeError("No error raised, but expected")
2 changes: 1 addition & 1 deletion dipy/utils/tripwire.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
""" Class to raise error for missing modules or other misfortunes
"""

class TripWireError(Exception):
class TripWireError(AttributeError):
""" Exception if trying to use TripWire object """


Expand Down
5 changes: 3 additions & 2 deletions tools/travis_tools.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Tools for working with travis-ci
export WHEELHOUSE="http://travis-wheels.scikit-image.org/"
export WHEELHOST="travis-wheels.scikit-image.org"
export WHEELHOUSE="http://${WHEELHOST}/"

retry () {
# https://gist.github.com/fungusakafungus/1026804
Expand All @@ -21,5 +22,5 @@ retry () {

wheelhouse_pip_install() {
# Install pip requirements via travis wheelhouse
retry pip install --timeout=60 --no-index --find-links $WHEELHOUSE $@
retry pip install --timeout=60 --no-index --trusted-host $WHEELHOST --find-links $WHEELHOUSE $@
}

0 comments on commit ef99b01

Please sign in to comment.