Skip to content

MRG, MAINT: Better notebook tests #9034

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

Merged
merged 9 commits into from
Apr 6, 2021
Merged

MRG, MAINT: Better notebook tests #9034

merged 9 commits into from
Apr 6, 2021

Conversation

larsoner
Copy link
Member

@larsoner larsoner commented Mar 12, 2021

  • Add nbexec fixture that can be used to run tests in an IPython kernel
  • Encapsulate existing tests in separate tests
  • Read test_3d.py and test_brain.py tests in test_notebook.py and use ipytest to run them (probably), need to figure out how to run only the notebook tests, using the notebook backend. Probably by replacing renderer_interactive with renderer_notebook using regex or so...

evts_dct = {'A': 1}
tn, tx = -1, 2
epochs = Epochs(raw_haemo, evts, event_id=evts_dct, tmin=tn, tmax=tx)
return epochs
Copy link
Member Author

Choose a reason for hiding this comment

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

From here up in this file is git mv / old code

@larsoner larsoner closed this Mar 26, 2021
@larsoner larsoner reopened this Mar 26, 2021
@larsoner
Copy link
Member Author

@GuillaumeFavelier can you take a look and see if you agree that test_notebook.py is a better testing infrastructure than test.ipynb? To me it will be easier to add stuff this way, but it has the disadvantage that you can't directly run the notebook.

@GuillaumeFavelier GuillaumeFavelier mentioned this pull request Apr 6, 2021
3 tasks
@GuillaumeFavelier
Copy link
Contributor

I'm fine not running in the notebook and updating test.ipynb directly is not convenient at all. I'll take a look and test locally

@GuillaumeFavelier
Copy link
Contributor

Similarly to #9190 (comment), the notebook tests were skipped so I pushed b08647c to fix that.

@GuillaumeFavelier
Copy link
Contributor

The tests are green for me locally and on Azure Notebook job:

...
mne/viz/_brain/tests/test_notebook.py::test_notebook_alignment[notebook] Coverage.py warning: --include is ignored because --source is set (include-ignored)
PASSED [ 17%]
mne/viz/_brain/tests/test_notebook.py::test_notebook_interactive[notebook] Coverage.py warning: --include is ignored because --source is set (include-ignored)
PASSED [ 17%]
mne/viz/_brain/tests/test_notebook.py::test_notebook_button_counts[notebook] Coverage.py warning: --include is ignored because --source is set (include-ignored)
PASSED [ 18%]
...

Is it still WIP? What is missing?

@larsoner larsoner changed the title WIP: Better notebook tests MRG, MAINT: Better notebook tests Apr 6, 2021
@larsoner
Copy link
Member Author

larsoner commented Apr 6, 2021

Is it still WIP? What is missing?

Ready for merge except tests still aren't passing on Windows:

c:\miniconda\lib\asyncio\events.py:501: in add_reader
    raise NotImplementedError
E   NotImplementedError

I think we probably just need to skip if the platform is Windows because it's probably not supported in some part of the stack. But I think we can rely on it working in practice for people. I'll push a commit to skip there

@larsoner larsoner merged commit 4add7d1 into mne-tools:main Apr 6, 2021
@larsoner larsoner deleted the nb branch April 6, 2021 16:34
@larsoner
Copy link
Member Author

larsoner commented Apr 6, 2021

Feel free to rebase #9190 and incorporate tests there!

vagechirkov pushed a commit to vagechirkov/mne-python that referenced this pull request Apr 6, 2021
* MAINT: Encapsulate and separate notebook tests

* FIX: Fixture

* MAINT: ipytest requirement

* ENH: Add

* WIP: Closer-ish

* FIX

* FIX: Scope?

* Fix conftest

* TST: Skip Windows

Co-authored-by: Guillaume Favelier <[email protected]>
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