Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
13 changes: 13 additions & 0 deletions tests/functional/test_install_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,3 +587,16 @@ def test_wheel_install_fails_with_badly_encoded_metadata(script):
assert "Error decoding metadata for" in result.stderr
assert "simple-0.1.0-py2.py3-none-any.whl" in result.stderr
assert "METADATA" in result.stderr


@pytest.mark.parametrize(
'package_name',
['simple-package', 'simple_package'],
)
def test_correct_package_name_while_creating_wheel_bug(script, package_name):
"""Check that the package name is correctly named while creating
a .whl file with a given format
"""
package = create_basic_wheel_for_package(script, package_name, '1.0')
wheel_name = os.path.basename(package)
assert wheel_name == 'simple_package-1.0-py2.py3-none-any.whl'
3 changes: 3 additions & 0 deletions tests/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,9 @@ def create_basic_wheel_for_package(
if extra_files is None:
extra_files = {}

# Fix wheel distribution name by replacing runs of non-alphanumeric
# characters with an underscore _ as per PEP 491
name = re.sub(r"[^\w\d.]+", "_", name, re.UNICODE)
archive_name = "{}-{}-py2.py3-none-any.whl".format(name, version)
archive_path = script.scratch_path / archive_name

Expand Down