-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add new_dandiset
fixture
#874
Conversation
Codecov Report
@@ Coverage Diff @@
## master #874 +/- ##
==========================================
- Coverage 86.66% 86.55% -0.12%
==========================================
Files 61 61
Lines 7194 7141 -53
==========================================
- Hits 6235 6181 -54
- Misses 959 960 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
return new_dandiset | ||
|
||
|
||
@pytest.fixture() |
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 wonder if both text_
and zarr_
dandisets should become (scope="session")
since they look like the ones to be reused for read-only purposes. And have some dedicated new_zarr_dandiset
(and similar new_text_dandiset
) with scope to the test for the use cases where needed to mutate?
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 think that would only be a good idea if we could somehow prevent the read-only Dandiset fixtures from being modified (both on disk and on the server); otherwise, it'd be too easy to accidentally use the wrong fixture and cause a test failure that ends up being hard to debug. I don't think the repeated recreating of Dandisets slows the tests down all that much.
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.
yeah, inability to guarantee immutability also worried me. I even was reminded today about pytest-dev/pytest#5044 after I thought that such "presumably a read only use of dandist" could be tested in fixture "turndown" code -- then we could catch cases where a test unexpectedly modifies a dandiset. I was thinking that there could be
- code which creates a new dandiset
- test scoped fixture which creates new dandiset only if doesn't exist, yields to the test, verifies that test did not change it. If it did -- destroys pre-created dandiset (so it would be created a new on next run) and
.fail
s the test with a message that immutability assumption was modified.
But I guess it might be all too much for this PR, so I am ok to proceed with this PR as is unless you see interest in above.
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.
Let's stick with the PR as it is now.
This PR factors out the repeated code for creating a new test Dandiset and uploading files to it into a fixture. It builds on top of/depends on #853 and thus has to be merged after it.