-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Replace tmpdir with tmp_path #9925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This has not been super fun (simply replacing
|
This to me suggests that there is some problem with the first check that's supposed to see "if data are not preloaded and we're trying to save to self._filenames[0], raise a ValueError", and instead you hit the second / subsequent check that is "if the filename exists and overwrite is False (default), then raise a FileExistsError". I would look into why using this new fixture has changed the behavior of the first check |
|
@larsoner the issue is that |
I would use |
|
This is now ready for review. Maybe worth a changelog entry too, but we can do this as the final step. |
|
@cbrnr can we now remove tmpdir from our fixtures? Did you already take care of this? 🙏 for the cleanup |
|
What do you mean by remove? I replaced |
|
And if you're in the flow of it @cbrnr perhaps you wanna do a quick pass on mne-bids as well, replacing the tmpdir -> tmp_path there? 😏 But I see your comment:
so if you've had enough for now, we'll just do it some other time when one of us has time and energy |
|
indeed tmpdir is a pytest builtin fixture.
git grep still says:
mne/gui/tests/test_coreg_gui.py:def
test_coreg_gui_pyvista_file_support(inst_path, tmpdir,
mne/gui/tests/test_coreg_gui.py: tempdir = str(tmpdir)
mne/gui/tests/test_coreg_gui.py:def test_coreg_gui_pyvista(tmpdir,
renderer_interactive_pyvistaqt):
mne/gui/tests/test_coreg_gui.py: tempdir = str(tmpdir)
is it expected to keep it there?
… |
|
@agramfort thanks for double-checking, I missed those. Now there are no @sappelhoff I can take a look, mne-bids is much smaller and therefore this should be much faster. |
|
Any idea what's going on with CircleCI now? https://app.circleci.com/pipelines/github/mne-tools/mne-python/11173/workflows/849f4079-3350-4539-be79-8cdff6404ee1/jobs/37508/parallel-runs/0/steps/0-103 |
|
@larsoner now in addition to CircleCI most (all?) Azure jobs are failing because of an issue with OpenGL install? |
|
Please ping me once that is merged. |
|
(This might be something where merge queues could be useful – we should definitely try them when they are available.) |
If you go to the PR and click the "subscribe" you'll get notified automatically |
|
@GuillaumeFavelier do you know why |
mne/tests/test_source_estimate.py
Outdated
| pytest.raises(ValueError, stc.save, tmpdir.join('tmp'), | ||
| ftype='foo') | ||
| out_name = tmpdir.join('tmp') | ||
| pytest.raises(ValueError, stc.save, tmp_path / 'tmp', ftype='foo') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| pytest.raises(ValueError, stc.save, tmp_path / 'tmp', ftype='foo') | |
| # different errors for (non)vector STCs | |
| match = (r"(Invalid value for the 'ftype' par)|" | |
| r"(VectorSourceEstimate objects can only be written ad HDF5)*") | |
| with pytest.raises(ValueError, match=match): | |
| stc.save(tmp_path / 'tmp', ftype='foo') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we go with this more specific error message catching or wait for the fix in #9944?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think my fix in #9944 will impact this comment -- it looks like this comment just improves/modernizes the pytest.raises usage. So yes feel free to commit this suggestion separately
* upstream/main: BUG: Force mayavi in test that uses it (mne-tools#9944)
larsoner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, will merge once CIs come back happy. Thanks @cbrnr
|
thx @cbrnr ! |
Fixes #9662.