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

BF: fix test error on Python 3 #1089

Merged
merged 1 commit into from Jul 1, 2016

Conversation

Projects
None yet
5 participants
@matthew-brett
Member

matthew-brett commented Jun 25, 2016

Numpy does not implement the __round__ method, causing the following
error when trying to use builtin round:

>>> round(np.array([1]))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: type numpy.ndarray doesn't define __round__ method

For the test error in dipy, see:
https://travis-ci.org/MacPython/dipy-wheels/jobs/140257955#L357

Use numpy's assert_almost_equal instead of the version from nose, to
avoid this problem.

BF: fix test error on Python 3
Numpy does not implement the `__round__` method, causing the following
error when trying to use builtin `round`:

    >>> round(np.array([1]))
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    TypeError: type numpy.ndarray doesn't define __round__ method

For the test error in dipy, see:
https://travis-ci.org/MacPython/dipy-wheels/jobs/140257955#L357

Use numpy's `assert_almost_equal` instead of the version from nose, to
avoid this problem.
@coveralls

This comment has been minimized.

coveralls commented Jun 25, 2016

Coverage Status

Coverage remained the same at 82.88% when pulling bdffaa3 on matthew-brett:fix-32-bit-test-error into 220d883 on nipy:master.

@codecov-io

This comment has been minimized.

codecov-io commented Jun 25, 2016

Current coverage is 80.35%

Merging #1089 into master will decrease coverage by 0.46%

@@             master      #1089   diff @@
==========================================
  Files           200        200          
  Lines         22985      22985          
  Methods           0          0          
  Messages          0          0          
  Branches       2309       2309          
==========================================
- Hits          18576      18470   -106   
- Misses         3933       4035   +102   
- Partials        476        480     +4   

Powered by Codecov. Last updated by 220d883...bdffaa3

@MarcCote

This comment has been minimized.

Contributor

MarcCote commented Jun 27, 2016

This PR seems to only change a few imports in test_metric.py. In the current Dipy's master round is not used.

@arokem

This comment has been minimized.

Member

arokem commented Jun 27, 2016

On a slightly related topic: how hard would it be to set up testing with a mac on Travis? It's fairly easy if you use Anaconda, but I don't know what it would entail here. As it is, errors like this will only get caught when building the wheels, which seems precarious.

@matthew-brett

This comment has been minimized.

Member

matthew-brett commented Jun 27, 2016

Notice that the use of round is in standard library version of the assert_almost_equal function - so the change in the import makes sure we are using the numpy version of that function instead.

Ariel - the test failure is on 32-bit Linux. It's a little involved to test this, because you need to spin up a 32-bit docker container to run the tests. It would certainly be a good idea to run the wheel tests fairly often, for example, make sure we have several beta or RC tags before release, and run on those.

@MarcCote

This comment has been minimized.

Contributor

MarcCote commented Jun 27, 2016

@matthew-brett oh, I see. My bad, I used the wrong import.

@arokem

This comment has been minimized.

Member

arokem commented Jun 27, 2016

Oh, gotcha. I must have missed that in the complexity of the setup of that thing.

@arokem

This comment has been minimized.

Member

arokem commented Jun 27, 2016

This seems good to me. Unless anyone has any objections, we can move ahead with this in a couple of days.

@arokem arokem merged commit fbad873 into nipy:master Jul 1, 2016

4 checks passed

codecov/patch 100% of diff hit (target 80.81%)
Details
codecov/project 80.81% (+0.00%) compared to 220d883
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 82.88%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment