Skip to content
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

The skhep_testdata.data_path function should run a checksum on the file that it finds #153

Open
jpivarski opened this issue May 16, 2024 · 0 comments

Comments

@jpivarski
Copy link
Member

We just came across another reason why it's dangerous to only check cached files by name (other than #147 (comment)): tests of uproot.update might change them in place and then subsequent tests are not testing what we think they're testing.

The ultimate solution for this would be for Scikit-HEP-testdata to maintain a mapping (dict? JSON?) of filename → checksum, generated and hard-coded into each release, and then the skhep_testdata.data_path function would both check to see that a file with the right name exists and that it has the right checksum. Computing a checksum of a < 1 MB file shouldn't be too expensive. (It has to be done every time a user requests a file path, or at least once per change of the file's late modified date, but that's more complicated.) In Python, it can be computed with hashlib.hash.hexdigest (StackOverflow). And then there's the added complication of embedding a hard-coded filename → checksum mapping, which would presumably need to be computed during the release phase.

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

No branches or pull requests

1 participant