Skip to content

Potential bug in "tests.lib.create_basic_wheel_for_package" #8064

@deveshks

Description

@deveshks

Environment

  • pip version: 20.1.dev0
  • Python version: 3.8.2
  • OS: OSX 10.15.4

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 as simple and the version is taken as package

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

def test_create_wheel_bug(script):

    package = create_basic_wheel_for_package(script, 'simple-package', '1.0')
    script.pip("install", "--no-cache-dir", "--no-index", package)
    result = script.pip('list', '--format=json')
    assert 'simple-package' in json.loads(result.stdout)

Output

The test fails with an assertion error because the output of pip list --format=json lists the package name as simple and version as package

 assert 'simple-package' in [{'name': 'pip', 'version': '20.1.dev0'}, 
{'name': 'setuptools', 'version': '46.1.3'}, {'name': 'simple', 'version': 'package'}]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: testsTesting and related thingsauto-lockedOutdated issues that have been locked by automationtype: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions