WIP: Experimenting with h5py mocking#5217
Open
matthewturk wants to merge 1 commit intoyt-project:mainfrom
Open
WIP: Experimenting with h5py mocking#5217matthewturk wants to merge 1 commit intoyt-project:mainfrom
matthewturk wants to merge 1 commit intoyt-project:mainfrom
Conversation
neutrinoceros
requested changes
Jul 18, 2025
Member
neutrinoceros
left a comment
There was a problem hiding this comment.
quick note: conftest.py shouldn't be used as a module to import stuff from, please use a dedicated module for that
Member
Author
|
Fair point! The import of the mock will need to go in there eventually though, right? So that pytest can pick it up? Where should I put it to avoid importing (Also that's just in my example script, not planning on having that be used anywhere other than testing the test :) ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is another WIP experiment. I have taken to heart what @Xarthisius has said for a while about how it would be nice to mock h5py.
This requires a file that can be generated, called
mock_hdf5_structure.jsonthat we can use. Here's code for generating a set of them:https://gist.github.com/matthewturk/5313f6318d89763fd4282f49c654d500
I've also included a fake one in there. You'll need to search-and-replace the path to get it to match yours, but if you then have a
.hierarchyand a parameter file next to it, you should be set. Then, interactively,Right now it'll generate a field list, but I need to properly implement
MockH5pyH5d.openandMockH5pyH5d.readbefore it'll do anything else. I'll give that a go.This would dramatically reduce the amount of data we'd need. I think with some additional coding we could mock up some other readers, too.