-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Potential bug in "tests.lib.create_basic_wheel_for_package" #8064
Comments
tests.lib.create_basic_wheel_for_package
Ah, this makes sense. The culprit is this line: archive_name = "{}-{}-py2.py3-none-any.whl".format(name, version) which would give The fix should be straightforward as well: archive_name = "{}-{}-py2.py3-none-any.whl".format(
canonicalize_name(name).replace('-', '_'),
version,
) |
I think that's the right approach, to canonicalize the name and replace |
I just realised PEP 491 actually includes a regex to canonically transform a package name for a wheel’s file name. Maybe we should use that instead (with a link to the PEP); it would be much easier to understand for a future reader. |
I think you mean So we would create a correct wheel file name using that regex? Also do we want to do anything with the folder name of the package as well for this change? Line 1000 in 2f3a1be
Also will the unit test for this be similar to what we discussed in #8054 ? (Note that the below might not work due to the quirk we found with
|
Yes, that’s it. The same name can be used for the package as well (I don’t think the package is actually used by a lot of tests anyway). @pradyunsg Does this need a test? |
Yea, I think adding a test in test_lib.py is a good idea. |
So what will that test do ? Is it enough to just try out variants of package names with dot, dash and underscore, and verify that the wheel file name is correct according to the spec for all 3 cases? |
Environment
Description
When the helper
tests.lib.create_basic_wheel_for_package
is utilized in a unit test to create a wheel with name containing a-
, e.g.simple-package
, and then the wheel is installed, the package name is taken assimple
and the version is taken aspackage
Expected behavior
Seems like according to PEP-491 file name convention, the package name cannot contain a
-
, so such package names shouldn't be allowed while creating wheels for testing purposes. (My understanding of the PEP might also be wrong here)How to Reproduce
Execute the following unit test
Output
The test fails with an assertion error because the output of
pip list --format=json
lists the package name assimple
and version aspackage
The text was updated successfully, but these errors were encountered: