Skip to content

Commit d786651

Browse files
larsoneragramfort
authored andcommitted
MRG: Minor fixes for 3.7 (#5831)
* FIX: Deprecations for 3.7 from other modules
1 parent e2c538b commit d786651

File tree

6 files changed

+32
-12
lines changed

6 files changed

+32
-12
lines changed

.travis.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: c
2-
dist: trusty
2+
dist: xenial
33
sudo: false
44
cache:
55
apt: true
@@ -9,7 +9,7 @@ env:
99
# OPENBLAS_NUM_THREADS=1 avoid slowdowns:
1010
# https://github.com/xianyi/OpenBLAS/issues/731
1111
global: PYTHON_VERSION=3.6 DISPLAY=:99.0 MNE_LOGGING_LEVEL=warning TEST_LOCATION=src
12-
PIP_DEPENDENCIES="codecov pytest-faulthandler pytest-sugar pytest-timeout nitime" OPTION=""
12+
PIP_DEPENDENCIES="codecov pytest-faulthandler pytest-sugar pytest-timeout nitime"
1313
TRAVIS_PYTHON_VERSION=3.6 CONDA_VERSION=">=4.3.27"
1414
OPENBLAS_NUM_THREADS=1
1515

@@ -20,7 +20,6 @@ matrix:
2020
env: DEPS=nodata MNE_DONTWRITE_HOME=true MNE_FORCE_SERIAL=true MNE_SKIP_NETWORK_TEST=1
2121
CONDA_DEPENDENCIES="numpy scipy matplotlib sphinx pytest pytest-cov"
2222
PIP_DEPENDENCIES="flake8 numpydoc codespell git+git://github.com/PyCQA/pydocstyle.git codecov check-manifest pytest-faulthandler pytest-sugar pytest-timeout"
23-
OPTION="--doctest-ignore-import-errors"
2423

2524
# Linux
2625
- os: linux
@@ -33,8 +32,9 @@ matrix:
3332
# PIP + non-default stim channel
3433
- os: linux
3534
env: MNE_STIM_CHANNEL=STI101
35+
PYTHON_VERSION=3.7
3636
language: python
37-
python: "3.6"
37+
python: "3.7"
3838

3939
# Old dependencies
4040
- os: linux
@@ -165,8 +165,8 @@ script:
165165
fi;
166166
done;
167167
fi;
168-
- echo py.test -m "${CONDITION}" ${OPTION} ${USE_DIRS} --cov=mne;
169-
- py.test -m "${CONDITION}" ${OPTION} ${USE_DIRS} --cov=mne;
168+
- echo pytest -m "${CONDITION}" ${USE_DIRS} --cov=mne;
169+
- pytest -m "${CONDITION}" ${USE_DIRS} --cov=mne;
170170
- if [ "${DEPS}" == "nodata" ]; then
171171
make pep;
172172
fi;

conftest.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,19 @@
44
# License: BSD (3-clause)
55

66
import pytest
7+
import warnings
8+
# For some unknown reason, on Travis-xenial there are segfaults caused on
9+
# the line pytest -> pdb.Pdb.__init__ -> "import readline". Forcing an
10+
# import here seems to prevent them (!?). This suggests a potential problem
11+
# with some other library stepping on memory where it shouldn't. It only
12+
# seems to happen on the Linux runs that install Mayavi. Anectodally,
13+
# @larsoner has had problems a couple of years ago where a mayavi import
14+
# seemed to corrupt SciPy linalg function results (!), likely due to the
15+
# associated VTK import, so this could be another manifestation of that.
16+
import readline # noqa
717

818

9-
@pytest.fixture(scope='package')
19+
@pytest.fixture(scope='session')
1020
def matplotlib_config():
1121
"""Configure matplotlib for viz tests."""
1222
import matplotlib
@@ -18,3 +28,10 @@ def matplotlib_config():
1828
# functionality)
1929
plt.ioff()
2030
plt.rcParams['figure.dpi'] = 100
31+
try:
32+
with warnings.catch_warnings(record=True): # traits
33+
from mayavi import mlab
34+
except Exception:
35+
pass
36+
else:
37+
mlab.options.backend = 'test'

mne/tests/test_docstring_parameters.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,10 @@ def test_docstring_parameters():
135135
continue
136136
with pytest.warns(None) as w:
137137
cdoc = docscrape.ClassDoc(cls)
138-
if len(w):
139-
raise RuntimeError('Error for __init__ of %s in %s:\n%s'
140-
% (cls, name, w[0]))
138+
for ww in w:
139+
if 'Using or importing the ABCs' not in str(ww.message):
140+
raise RuntimeError('Error for __init__ of %s in %s:\n%s'
141+
% (cls, name, ww))
141142
if hasattr(cls, '__init__'):
142143
incorrect += check_parameters_match(cls.__init__, cdoc)
143144
for method_name in cdoc.methods:

mne/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,6 @@ def wrapper(func):
12641264
_mayavi_call = """
12651265
with warnings.catch_warnings(record=True): # traits
12661266
from mayavi import mlab
1267-
mlab.options.backend = 'test'
12681267
"""
12691268

12701269
_mne_call = """

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pytest
1616
pytest-cov
1717
pytest-sugar
1818
pytest-timeout
19+
pytest-faulthandler
1920
joblib
2021
psutil
2122
dipy

setup.cfg

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ filterwarnings =
3333
ignore:joblib not installed:RuntimeWarning
3434
ignore:Using a non-tuple sequence for multidimensional indexing:FutureWarning
3535
ignore:using a non-integer number instead of an integer will result in an error:DeprecationWarning
36-
ignore:Importing from numpy.testing.decorators is deprecated, import from numpy.testing instead:DeprecationWarning
36+
ignore:Importing from numpy.testing.decorators is deprecated:DeprecationWarning
3737
ignore:np.loads is deprecated, use pickle.loads instead:DeprecationWarning
3838
ignore:The oldnumeric module will be dropped:DeprecationWarning
3939
ignore:Collection picker None could not be converted to float:UserWarning
4040
ignore:covariance is not positive-semidefinite:RuntimeWarning
4141
ignore:Can only plot ICA components:RuntimeWarning
4242
ignore:Matplotlib is building the font cache using fc-list:UserWarning
43+
ignore:Using or importing the ABCs from 'collections':DeprecationWarning
44+
ignore:`formatargspec` is deprecated:DeprecationWarning
4345

4446
[flake8]
4547
exclude = __init__.py,*externals*,constants.py,fixes.py

0 commit comments

Comments
 (0)