-
Notifications
You must be signed in to change notification settings - Fork 87
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
[MRG] Add tiny BIDS test dataset, fix doctests, and run it in CI #831
Conversation
+1 for pytest --doctest-modules is it a lot of work? |
Maybe 🤔 Let's see, I'll work on this a bit in the next days. |
Codecov Report
@@ Coverage Diff @@
## main #831 +/- ##
==========================================
+ Coverage 94.17% 94.58% +0.41%
==========================================
Files 23 23
Lines 3123 3123
==========================================
+ Hits 2941 2954 +13
+ Misses 182 169 -13
Continue to review full report at Codecov.
|
I think the problem is that many examples rely on us having some files. So I'd have to "skip" executing most of the examples, which defeats the purpose. I think a solution would be to "ship" a tiny BIDS dataset as part of the test directory that we can use to actually execute the examples. WDYT @hoechenberger @agramfort ? |
how would you "ship" it?
… |
|
if we manage to make it less than 30MB I would say why not to add it to the
git repo like mne/io/tests/data folder in mne-python
|
we did not do that before either, but --doctest-modules is now ON and that option apparently also runs the examples
@sappelhoff Apparently you forgot one or two places? @ CI failing |
one is about The other one, I am still investigating |
I think it's because in the test you're comparing to a path constructed via |
Wait, why is that? IMHO it should always be a path … |
yes, also according to the attributes docs in the docstr. But see: Lines 442 to 449 in 2d8a721
I am a little confused by that Union(str, Path) |
Maybe the solution is: def __repr__(self):
"""Representation in the style of `pathlib.Path`."""
return f'{self.__class__.__name__}(\n' \
- f'root: {self.root}\n' \
+ f'root: {self.root.as_posix()}\n' \
f'datatype: {self.datatype}\n' \
f'basename: {self.basename})' but root can be "None" 🤔 |
I think there is something I don't understand in Lines 442 to 449 in 2d8a721
|
Do we need a |
Considering point 3, I would agree that the type hint is incorrect and should be |
mmh okay - but it could be BTW: the errors are now fixed. I circumvented the repr/str issue for bids_path attributes by calling |
we'd only need it for |
In Python 3.10 we'll be able to simply write But your proposal in 459c723 is redundant; you can safely switch to |
Thanks for the hint, will push a commit! |
☝️ I see what you did there! 😎 |
How about we always store |
Can we store it as a |
Nice idea, I think this could work |
Ok cool, I opened a new issue for it :-) Please merge this one if you are happy @hoechenberger I could then do the release next. |
Thanks a bunch, @sappelhoff! |
follow up to #828
closes #829
This adds a tiny (800kb) BIDS dataset to a new
tests/data
directory for testing purposes.Code for generating the data is shipped in
mne_bids/tests/data/tiny_bids/code/make_tiny_bids_dataset.py
, this dataset should be easily extensible in the future to add MEG, MRIs, iEEG, etc. when the need for it arises.I make use of that dataset in the doctests, which I fix in this PR and "turn on" in CI checks.
I also use that dataset in an example, fixing #829
Adding the example dataset also showed me in its git diff that we have been writing TSV files without newline characters, violating UNIX/POSIX standards 😉 I remedied that.
Finally, this PR contains 3 "fixes" where I change json.dump to our internal _write_json, thereby simplifying some lines.
The diff is large, but most of it is the newly added data.
Merge checklist
Maintainer, please confirm the following before merging: