Skip to content

Commit a423139

Browse files
authored
Merge pull request #1095 from effigies/ci/simplify
MNT: Remove direct calls to setup.py, clean up install docs, update warnings
2 parents 75c2b85 + b12e700 commit a423139

File tree

14 files changed

+71
-65
lines changed

14 files changed

+71
-65
lines changed

.github/workflows/misc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
continue-on-error: true
2323
strategy:
2424
matrix:
25-
python-version: [3.8]
26-
install: ['setup']
25+
python-version: ["3.10"]
26+
install: ['pip']
2727
check: ['style', 'doc']
2828
pip-flags: ['']
2929
depends: ['REQUIREMENTS']

.github/workflows/pre-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
2929
python-version: ["3.9", "3.10"]
3030
architecture: ['x64', 'x86']
31-
install: ['setup']
31+
install: ['pip']
3232
check: ['test']
3333
pip-flags: ['PRE_PIP_FLAGS']
3434
depends: ['REQUIREMENTS']
@@ -37,7 +37,7 @@ jobs:
3737
# Pydicom master
3838
- os: ubuntu-latest
3939
python-version: "3.10"
40-
install: setup
40+
install: pip
4141
check: test
4242
pip-flags: ''
4343
depends: REQUIREMENTS

.github/workflows/stable.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,23 @@ jobs:
4040
# Basic dependencies only
4141
- os: ubuntu-latest
4242
python-version: 3.7
43-
install: setup
43+
install: pip
4444
check: test
4545
pip-flags: ''
4646
depends: REQUIREMENTS
4747
optional-depends: ''
4848
# Absolute minimum dependencies
4949
- os: ubuntu-latest
5050
python-version: 3.7
51-
install: setup
51+
install: pip
5252
check: test
5353
pip-flags: ''
5454
depends: MIN_REQUIREMENTS
5555
optional-depends: ''
5656
# Absolute minimum dependencies plus old MPL, Pydicom, Pillow
5757
- os: ubuntu-latest
5858
python-version: 3.7
59-
install: setup
59+
install: pip
6060
check: test
6161
pip-flags: ''
6262
depends: MIN_REQUIREMENTS

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ env:
1717
- DEPENDS="REQUIREMENTS"
1818
- OPTIONAL_DEPENDS="DEFAULT_OPT_DEPENDS"
1919
- EXTRA_PIP_FLAGS=""
20-
- INSTALL_TYPE="setup"
20+
- INSTALL_TYPE="pip"
2121
- CHECK_TYPE="test"
2222

2323
python:
@@ -35,7 +35,6 @@ before_install:
3535
# command to install dependencies
3636
install:
3737
- tools/ci/install.sh
38-
- if [ "$CHECK_TYPE" == "skiptests" ]; then exit 0; fi
3938

4039
# command to run tests, e.g. python setup.py test
4140
script:

doc/source/installation.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
Installation
1414
************
1515

16-
NiBabel is a pure Python package at the moment, and it should be easy to get
17-
NiBabel running on any system. For the most popular platforms and operating
18-
systems there should be packages in the respective native packaging format
19-
(DEB, RPM or installers). On other systems you can install NiBabel using
20-
pip_ or by downloading the source package and running the usual ``python
21-
setup.py install``.
16+
NiBabel is a pure Python package,
17+
and it should be easy to get NiBabel running on any system.
18+
For the most popular platforms and operating systems
19+
there should be packages in the respective native packaging format
20+
(DEB, RPM or installers).
21+
On other systems you can install NiBabel using pip_.
2222

2323
.. This remark below is not yet true; comment to avoid confusion
2424
To run all of the tests, you may need some extra data packages - see
@@ -121,14 +121,15 @@ Validating your install
121121
For a basic test of your installation, fire up Python and try importing the
122122
module to see if everything is fine. It should look something like this::
123123

124-
Python 2.7.8 (v2.7.8:ee879c0ffa11, Jun 29 2014, 21:07:35)
125-
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
124+
Python 3.8.5 (default, Sep 4 2020, 07:30:14)
125+
[GCC 7.3.0] :: Anaconda, Inc. on linux
126126
Type "help", "copyright", "credits" or "license" for more information.
127127
>>> import nibabel
128128
>>>
129129

130130

131-
To run the nibabel test suite, from the terminal run ``pytest nibabel`` or
131+
To run the nibabel test suite, from the terminal run
132+
``pytest --pyargs nibabel`` or
132133
``python -c "import nibabel; nibabel.test()``.
133134

134135
To run an extended test suite that validates ``nibabel`` for long-running and

nibabel/nicom/tests/test_dicomwrappers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,10 @@ def test_assert_parallel():
361361

362362
@dicom_test
363363
def test_decimal_rescale():
364-
# Test that we don't get back a data array with dtype np.object when our
364+
# Test that we don't get back a data array with dtype object when our
365365
# rescale slope is a decimal
366366
dw = didw.wrapper_from_file(DATA_FILE_DEC_RSCL)
367-
assert dw.get_data().dtype != np.object
367+
assert dw.get_data().dtype != np.dtype(object)
368368

369369

370370
def fake_frames(seq_name, field_name, value_seq):

nibabel/streamlines/tests/test_streamlines.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import unittest
33
import tempfile
44
import numpy as np
5+
import warnings
56

67
import pytest
78

@@ -12,7 +13,7 @@
1213
from nibabel.tmpdirs import InTemporaryDirectory
1314
from numpy.compat.py3k import asbytes
1415

15-
from nibabel.testing import data_path
16+
from nibabel.testing import data_path, error_warnings, clear_and_catch_warnings
1617

1718
from .test_tractogram import assert_tractogram_equal
1819
from ..tractogram import Tractogram, LazyTractogram
@@ -142,7 +143,7 @@ def test_load_empty_file(self):
142143
else:
143144
assert type(tfile.tractogram), LazyTractogram
144145

145-
with pytest.warns(Warning if lazy_load else None):
146+
with pytest.warns(Warning) if lazy_load else error_warnings():
146147
assert_tractogram_equal(tfile.tractogram,
147148
DATA['empty_tractogram'])
148149

@@ -158,7 +159,7 @@ def test_load_simple_file(self):
158159
else:
159160
assert type(tfile.tractogram), LazyTractogram
160161

161-
with pytest.warns(Warning if lazy_load else None):
162+
with pytest.warns(Warning) if lazy_load else error_warnings():
162163
assert_tractogram_equal(tfile.tractogram,
163164
DATA['simple_tractogram'])
164165

@@ -184,7 +185,7 @@ def test_load_complex_file(self):
184185
data = DATA['data_per_streamline']
185186
tractogram.data_per_streamline = data
186187

187-
with pytest.warns(Warning if lazy_load else None):
188+
with pytest.warns(Warning) if lazy_load else error_warnings():
188189
assert_tractogram_equal(tfile.tractogram,
189190
tractogram)
190191

@@ -244,7 +245,8 @@ def test_save_complex_file(self):
244245
((not cls.SUPPORTS_DATA_PER_POINT) +
245246
(not cls.SUPPORTS_DATA_PER_STREAMLINE))
246247

247-
with pytest.warns(Warning if nb_expected_warnings else None) as w:
248+
with clear_and_catch_warnings() as w:
249+
warnings.simplefilter('always')
248250
nib.streamlines.save(complex_tractogram, filename)
249251
assert len(w) == nb_expected_warnings
250252

nibabel/streamlines/tests/test_tck.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import pytest
1717
from numpy.testing import assert_array_equal
18-
from ...testing import data_path
18+
from ...testing import data_path, error_warnings
1919
from .test_tractogram import assert_tractogram_equal
2020

2121
DATA = {}
@@ -47,13 +47,13 @@ class TestTCK(unittest.TestCase):
4747
def test_load_empty_file(self):
4848
for lazy_load in [False, True]:
4949
tck = TckFile.load(DATA['empty_tck_fname'], lazy_load=lazy_load)
50-
with pytest.warns(Warning if lazy_load else None):
50+
with pytest.warns(Warning) if lazy_load else error_warnings():
5151
assert_tractogram_equal(tck.tractogram, DATA['empty_tractogram'])
5252

5353
def test_load_simple_file(self):
5454
for lazy_load in [False, True]:
5555
tck = TckFile.load(DATA['simple_tck_fname'], lazy_load=lazy_load)
56-
with pytest.warns(Warning if lazy_load else None):
56+
with pytest.warns(Warning) if lazy_load else error_warnings():
5757
assert_tractogram_equal(tck.tractogram, DATA['simple_tractogram'])
5858

5959
# Force TCK loading to use buffering.
@@ -88,7 +88,7 @@ def test_load_simple_file_in_big_endian(self):
8888
for lazy_load in [False, True]:
8989
tck = TckFile.load(DATA['simple_tck_big_endian_fname'],
9090
lazy_load=lazy_load)
91-
with pytest.warns(Warning if lazy_load else None):
91+
with pytest.warns(Warning) if lazy_load else error_warnings():
9292
assert_tractogram_equal(tck.tractogram, DATA['simple_tractogram'])
9393
assert tck.header['datatype'] == 'Float32BE'
9494

nibabel/streamlines/tests/test_trk.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from io import BytesIO
99

1010
import pytest
11-
from ...testing import data_path, clear_and_catch_warnings, assert_arr_dict_equal
11+
from ...testing import data_path, clear_and_catch_warnings, assert_arr_dict_equal, error_warnings
1212
from numpy.testing import assert_array_equal
1313

1414
from .test_tractogram import assert_tractogram_equal
@@ -87,19 +87,19 @@ class TestTRK(unittest.TestCase):
8787
def test_load_empty_file(self):
8888
for lazy_load in [False, True]:
8989
trk = TrkFile.load(DATA['empty_trk_fname'], lazy_load=lazy_load)
90-
with pytest.warns(Warning if lazy_load else None):
90+
with pytest.warns(Warning) if lazy_load else error_warnings():
9191
assert_tractogram_equal(trk.tractogram, DATA['empty_tractogram'])
9292

9393
def test_load_simple_file(self):
9494
for lazy_load in [False, True]:
9595
trk = TrkFile.load(DATA['simple_trk_fname'], lazy_load=lazy_load)
96-
with pytest.warns(Warning if lazy_load else None):
96+
with pytest.warns(Warning) if lazy_load else error_warnings():
9797
assert_tractogram_equal(trk.tractogram, DATA['simple_tractogram'])
9898

9999
def test_load_complex_file(self):
100100
for lazy_load in [False, True]:
101101
trk = TrkFile.load(DATA['complex_trk_fname'], lazy_load=lazy_load)
102-
with pytest.warns(Warning if lazy_load else None):
102+
with pytest.warns(Warning) if lazy_load else error_warnings():
103103
assert_tractogram_equal(trk.tractogram, DATA['complex_tractogram'])
104104

105105
def trk_with_bytes(self, trk_key='simple_trk_fname', endian='<'):
@@ -199,7 +199,7 @@ def test_load_complex_file_in_big_endian(self):
199199
for lazy_load in [False, True]:
200200
trk = TrkFile.load(DATA['complex_trk_big_endian_fname'],
201201
lazy_load=lazy_load)
202-
with pytest.warns(Warning if lazy_load else None):
202+
with pytest.warns(Warning) if lazy_load else error_warnings():
203203
assert_tractogram_equal(trk.tractogram, DATA['complex_tractogram'])
204204

205205
def test_tractogram_file_properties(self):

nibabel/tests/test_quaternions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import pytest
1515

16-
from numpy.testing import assert_array_almost_equal, assert_array_equal, dec
16+
from numpy.testing import assert_array_almost_equal, assert_array_equal
1717

1818
from .. import quaternions as nq
1919
from .. import eulerangles as nea
@@ -122,7 +122,6 @@ def test_norm():
122122
assert not nq.isunit(qi)
123123

124124

125-
@dec.slow
126125
@pytest.mark.parametrize("M1, q1", eg_pairs[0::4])
127126
@pytest.mark.parametrize("M2, q2", eg_pairs[1::4])
128127
def test_mult(M1, q1, M2, q2):

0 commit comments

Comments
 (0)