3
3
import os .path as op
4
4
from os .path import join as pjoin
5
5
import sys
6
- import warnings
7
6
8
7
import pytest
9
8
from mayavi import mlab
17
16
from surfer .utils import (requires_fsaverage , requires_imageio , requires_fs ,
18
17
_get_extra )
19
18
20
- warnings .simplefilter ('always' )
21
-
22
19
subject_id = 'fsaverage'
23
20
std_args = [subject_id , 'lh' , 'inflated' ]
24
21
data_dir = pjoin (op .dirname (__file__ ), '..' , '..' , 'examples' , 'example_data' )
@@ -85,21 +82,12 @@ def test_image(tmpdir):
85
82
brain = Brain (subject_id , 'both' , surf = surf , size = 100 )
86
83
brain .add_overlay (overlay_fname , hemi = 'lh' , min = 5 , max = 20 , sign = "pos" )
87
84
brain .save_imageset (tmp_name , ['med' , 'lat' ], 'jpg' )
88
- brain .close ()
89
- del brain
90
-
91
- brain = Brain (* std_args , size = 100 )
92
- for b in brain .brain_matrix .ravel ():
93
- assert b ._f .scene is not None
94
85
brain .save_image (tmp_name )
95
86
brain .save_image (tmp_name , 'rgba' , True )
96
87
brain .screenshot ()
97
- if os .getenv ('TRAVIS' , '' ) != 'true' :
98
- # for some reason these fail on Travis sometimes
99
- brain .save_montage (tmp_name , ['l' , 'v' , 'm' ], orientation = 'v' )
100
- brain .save_montage (tmp_name , ['l' , 'v' , 'm' ], orientation = 'h' )
101
- brain .save_montage (tmp_name , [['l' , 'v' ], ['m' , 'f' ]])
102
- brain .close ()
88
+ brain .save_montage (tmp_name , ['l' , 'v' , 'm' ], orientation = 'v' )
89
+ brain .save_montage (tmp_name , ['l' , 'v' , 'm' ], orientation = 'h' )
90
+ brain .save_montage (tmp_name , [['l' , 'v' ], ['m' , 'f' ]])
103
91
104
92
105
93
@requires_fsaverage ()
@@ -108,8 +96,7 @@ def test_brains():
108
96
# testing backend breaks when passing in a figure, so we use 'auto' here
109
97
# (shouldn't affect usability, but it makes testing more annoying)
110
98
_set_backend ('auto' )
111
- with warnings .catch_warnings (record = True ): # traits for mlab.figure()
112
- mlab .figure (101 )
99
+ mlab .figure (101 )
113
100
surfs = ['inflated' , 'white' , 'white' , 'white' , 'white' , 'white' , 'white' ]
114
101
hemis = ['lh' , 'rh' , 'both' , 'both' , 'rh' , 'both' , 'both' ]
115
102
titles = [None , 'Hello' , 'Good bye!' , 'lut test' ,
@@ -122,8 +109,7 @@ def test_brains():
122
109
(0.2 , 0.2 , 0.2 ), "black" , "0.75" ]
123
110
foregrounds = ["black" , "white" , "0.75" , "red" ,
124
111
(0.2 , 0.2 , 0.2 ), "blue" , "black" ]
125
- with warnings .catch_warnings (record = True ): # traits for mlab.figure()
126
- figs = [101 , mlab .figure (), None , None , mlab .figure (), None , None ]
112
+ figs = [101 , mlab .figure (), None , None , mlab .figure (), None , None ]
127
113
subj_dir = utils ._get_subjects_dir ()
128
114
subj_dirs = [None , subj_dir , subj_dir , subj_dir ,
129
115
subj_dir , subj_dir , subj_dir ]
@@ -153,7 +139,6 @@ def test_annot():
153
139
annots = ['aparc' , 'aparc.a2005s' ]
154
140
borders = [True , False , 2 ]
155
141
alphas = [1 , 0.5 ]
156
- gc .collect ()
157
142
brain = Brain (* std_args )
158
143
view = get_view (brain )
159
144
@@ -463,9 +448,8 @@ def test_probabilistic_labels():
463
448
prob_field [ids ] = probs
464
449
brain .add_data (prob_field , thresh = 1e-5 )
465
450
466
- with warnings .catch_warnings (record = True ):
467
- brain .data ["colorbar" ].number_of_colors = 10
468
- brain .data ["colorbar" ].number_of_labels = 11
451
+ brain .data ["colorbar" ].number_of_colors = 10
452
+ brain .data ["colorbar" ].number_of_labels = 11
469
453
brain .close ()
470
454
471
455
0 commit comments