Conversation
Codecov ReportBase: 89.15% // Head: 89.07% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #1180 +/- ##
==========================================
- Coverage 89.15% 89.07% -0.09%
==========================================
Files 76 76
Lines 9510 9444 -66
==========================================
- Hits 8479 8412 -67
- Misses 1031 1032 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
|
@TheChymera |
|
@jwodder thanks :) So I can check for metadata and it's the correct metadata via for ddfe305: Does that mean the schema is somehow malformed? The actual error look like it has something to do with an invalid URL, though 🤔 |
|
@TheChymera Where were you running the tests to see that output? The environment variable |
|
oh, yes, that was indeed it, I was running pytest directly to point it at the test I was working on:
|
dandi/tests/test_upload.py
Outdated
| # Automatically check all files, heuristic should remain very BIDS-stable | ||
| for asset in dandiset.get_assets(order="path"): | ||
| apath = asset.path | ||
| if "Sub1" in apath: |
There was a problem hiding this comment.
Just test on some known paths since if we later rename from Sib1, this test would pass without testing anything
There was a problem hiding this comment.
How about 288715e ? I like that we're checking all of them, at trivial additional time cost.
There was a problem hiding this comment.
it is not runtime which concerned me but possible absent checking if that dataset changes so that eg there is no subjects -- this test would still be valid. ok let's consider it unlikely and proceed
| def test_upload_bids_metadata( | ||
| mocker: MockerFixture, bids_dandiset: SampleDandiset | ||
| ) -> None: | ||
| bids_dandiset.upload(existing="force") |
There was a problem hiding this comment.
why upload needs to be forced?
There was a problem hiding this comment.
oh, you always do that... not sure if that is a good/clean practice, not liking it.. but not unique to this test, so let's proceed.
| if "sub-" in apath: | ||
| metadata = dandiset.get_asset_by_path(apath).get_metadata() | ||
| # Hard-coded check for the subject identifier set in the fixture: | ||
| assert metadata.wasAttributedTo[0].identifier == "Sub1" |
There was a problem hiding this comment.
this is a very rudimentary bids dataset, not even with sessions or other interesting assets,... oh well, ok, at least we check that subject is extracted. We would need to improve later
|
🚀 PR was released in |
Closes: dandi/dandisets#220
The idea is to add a test which ensures that the upload code produces BIDS assets for which the correct data can always be retrieved. Currently we just check a few of the files being uploaded. I think it already works in any case, but would be a good add-on test.
@yarikoptic @jwodder any ideas how I can access the metadata of the remote asset? I tried to look at other tests which check metadata, but thus far I haven't found anything that does that.