def test_subject_source_with_fsaverage(): """Test SubjectSelector""" from mne.gui._file_traits import MRISubjectSource mri = MRISubjectSource() assert_false(mri.can_create_fsaverage) assert_raises(RuntimeError, mri.create_fsaverage) mri.subjects_dir = tempdir assert_true(mri.can_create_fsaverage) mri.create_fsaverage()
def test_subject_source_with_fsaverage(): """Test SubjectSelector""" from mne.gui._file_traits import MRISubjectSource mri = MRISubjectSource() assert_false(mri.can_create_fsaverage) assert_raises(RuntimeError, mri.create_fsaverage) mri.subjects_dir = tempdir assert_true(mri.can_create_fsaverage) mri.create_fsaverage()
def test_subject_source_with_fsaverage(tmpdir): """Test SubjectSelector.""" from mne.gui._file_traits import MRISubjectSource tempdir = str(tmpdir) mri = MRISubjectSource() assert not mri.can_create_fsaverage pytest.raises(RuntimeError, mri.create_fsaverage) mri.subjects_dir = tempdir assert mri.can_create_fsaverage assert not op.isdir(op.join(tempdir, 'fsaverage')) # fake FREESURFER_HOME with modified_env(FREESURFER_HOME=data_path): mri.create_fsaverage() assert op.isdir(op.join(tempdir, 'fsaverage'))
def test_subject_source_with_fsaverage(): """Test SubjectSelector.""" from mne.gui._file_traits import MRISubjectSource tempdir = _TempDir() mri = MRISubjectSource() assert not mri.can_create_fsaverage pytest.raises(RuntimeError, mri.create_fsaverage) mri.subjects_dir = tempdir assert mri.can_create_fsaverage assert not op.isdir(op.join(tempdir, 'fsaverage')) # fake FREESURFER_HOME old_val = os.getenv('FREESURFER_HOME') os.environ['FREESURFER_HOME'] = data_path try: mri.create_fsaverage() finally: if old_val is not None: os.environ['FREESURFER_HOME'] = old_val assert op.isdir(op.join(tempdir, 'fsaverage'))