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

Remove some binary test files #1206

Merged
merged 2 commits into from
Jan 9, 2025
Merged

Conversation

dnicolodi
Copy link
Contributor

I have noticed (well, a little more than noticed, I've contributed one) that there are a few binary files used as fixtures for test. I think that these are problematic for a couple of reasons.

First and most importantly, it is difficult to determine what aspect of the code these files are testing or what peculiarity of these files is used in the test This could be solved with better code comments at the location where these files are used, but I believe it is much easier and self explanatory to have the test create and consume test files in nearby code locations that can be easily inspected. For the case of one of the files removed here, for example, it seems that it does not contribute anything to the testing, at is identical to another test file. Generating the test files as part of the test suite is easy and, as I'll show with patches in another PR, most of the tests just need a minimal test files that passes twine internal validation, thus a big test file as used now are definitely overkill.

Second, especially after the xz accident, people is rightfully worried when they see binary blobs into the source of software packages. This is especially true for archive file formats, for which it is notoriously hard to properly verify the content.

Third, they increase the size of the source distribution without adding much value.

Here I am removing two test files the really do nothing, thus I think the patches should be relatively uncontroversial.

@dnicolodi dnicolodi force-pushed the rm-binary-blobs-part1 branch 2 times, most recently from 75da1e3 to 79c7d4e Compare December 19, 2024 12:53
This test file was added in 8b8790b (Add tests to ensure version
parsing does not regress, part of pypa#147) with the intent of testing the
target Python version from wheel file names.

However, the filename is identical to the one of the other text
fixture tests/fixtures/twine-1.5.0-py2.py3-none-any.whl thus it does
not appear to add any additional coverage to the code extracting the
target Python version.
This test file was added in 0605ef0 (Switch to packaging for
parsing metadata and support metadata 2.4, pypa#1180) but the tests added
in that commit used minimal zip archives generated on the fly to test
the same code paths.
@dnicolodi dnicolodi force-pushed the rm-binary-blobs-part1 branch from 79c7d4e to b2832de Compare December 26, 2024 23:17
Copy link
Member

@woodruffw woodruffw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dnicolodi!

Copy link
Member

@woodruffw woodruffw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, forgot to merge earlier. LGTM still.

@woodruffw woodruffw merged commit fd0646e into pypa:main Jan 9, 2025
26 checks passed
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

Successfully merging this pull request may close these issues.

2 participants