Refactor test_plot_alignment_basic()
What does this implement/fix?
This is a PR to simplify an overly long and complicated test in the testing suite for #D visualization. This refactor breaks testing of the function mne.viz.plot_alignment into manageable chunks, separating tests of different parameters, and separating error checking from test plots (except where doing so would add extra up front instantiations).
@larsoner @drammock Hey Eric, something I noticed while doing this refactor is that our volumetric source space example in our testing data set does not have a value for the subject field, i.e. src._subject is blank. I can hack it to make it work for this PR, but I wondered if perhaps we should update the volumetric source space in the testing data (MNE-testing-data/subjects/sample/bem/sample-volume-7mm-src.fif), since plotting functions want the subject field filled. What do you think?
We could, but it's also pretty easy to add a
@pytest.fixture
@testing.requires_testing_data
def vol_src():
src = mne.read_source_spaces(...)
src._subject = "sample"
return src
instead, which might be preferable anyway since it avoids some boilerplate. There are some similar things here already
https://github.com/mne-tools/mne-python/blob/7ed5e27dc794171ed5248605804034b4cc44c928/mne/conftest.py#L783
Code coverage is equal between main and this branch, so I think this is ready to go!