Commit 727dd60f authored by Paul Ganssle's avatar Paul Ganssle

Fix bdist_rpm and bdist_dumb in upload_file

This fixes uploads when bdist_rpm or bdist_dumb are the command, both of
which insert a comment about what platform they are built for.
parent b5c9c5f4
......@@ -2,6 +2,7 @@ import io
import os
import hashlib
import getpass
import platform
from base64 import standard_b64encode
......
......@@ -202,3 +202,24 @@ class TestUploadTest:
# Read the 'signed' data that was transmitted
entries = patched_upload.get_uploaded_metadata()
assert entries['gpg_signature'] == 'signed-data'
@pytest.mark.parametrize('bdist', ['bdist_rpm', 'bdist_dumb'])
@mock.patch('setuptools.command.upload.platform')
def test_bdist_rpm_upload(self, platform, bdist, patched_upload):
# Set the upload command to include bdist_rpm
cmd = patched_upload.cmd
dist_files = cmd.distribution.dist_files
dist_files = [(bdist,) + dist_files[0][1:]]
cmd.distribution.dist_files = dist_files
# Mock out the platform commands to make this platform-independent
platform.dist.return_value = ('redhat', '', '')
cmd.ensure_finalized()
cmd.run()
entries = patched_upload.get_uploaded_metadata()
assert entries['comment'].startswith(u'built for')
assert len(entries['comment']) > len(u'built for')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment