Skip to content

Conversation

@larsoner
Copy link
Contributor

@larsoner larsoner commented Jun 3, 2021

Opens a PR to address the comment in mne-tools/mne-python#9406 (comment), namely that trying to open a file that does not exist should raise FileNotFoundError rather than ValueError. In trying to test this, pytest failed for me, for two reasons:

  1. The mfz file did not exist. Some sleuthing suggested that I needed to do python ./bin/mff2mfz.py ./examples/example_1.mff, but it seems cleaner just to do it automagically using pytest conftest.py, which is now implemented.
  2. When I had some failures due to my changes, I'd get some failures not due to my changes because of poor test isolation in test_writer.py. Specfically, the use of .cache across a bunch of tests creates dependencies that can be problematic. Using the standard tmpdir pytest fixture is a clean, standard way to address this issue, so I implemented it.

I can revert these if you want, but in theory this should make it easier for your users (or CIs, if you want to implement them!) to do pytest and just have things work, and to iterate over tests more easily.

@ephathaway
Copy link
Member

  1. The mfz file did not exist. Some sleuthing suggested that I needed to do python ./bin/mff2mfz.py ./examples/example_1.mff, but it seems cleaner just to do it automagically using pytest conftest.py, which is now implemented.

Running make test will create the necessary .mfz file.

@larsoner
Copy link
Contributor Author

larsoner commented Jun 3, 2021

Running make test will create the necessary .mfz file.

I think the autouse fixture is a bit more standard, do you agree it's worth keeping the new way? If so I can clean up the makefile not to need this and people can just do pytest (or make test) and have everything work properly. If not, I can delete the autouse fixture

@ephathaway
Copy link
Member

do you agree it's worth keeping the new way?

Yeah, let's keep it. I think this will make it a bit more user friendly.

@ephathaway
Copy link
Member

@larsoner, please take a look at larsoner#1. Thanks

Copy link
Member

@ephathaway ephathaway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@larsoner can you go ahead and remove the mff2mfz.py call from the makefile? Then I think this is ready to merge.

@larsoner
Copy link
Contributor Author

larsoner commented Jun 5, 2021

I left the conversion target itself in there but removed the call to it in make test. Can remove the conversion target, too, if you prefer

@ephathaway
Copy link
Member

I left the conversion target itself in there but removed the call to it in make test. Can remove the conversion target, too, if you prefer

I think the way you did it makes sense. Thanks. See larsoner#2 to address the GH workflow failure.

@larsoner
Copy link
Contributor Author

The pesky "workflow awaiting approval" box needs to clicked to get CIs to run here

Copy link
Member

@ephathaway ephathaway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @larsoner!

@ephathaway ephathaway merged commit ca2eafc into BEL-Public:develop Jun 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants