コード例 #1
0
def test_name():
    "Wheel.name() Should use the attributes associated to the Wheel instance to build a valid wheel file name"

    # Given the following wheel
    wheel = Wheel()
    wheel.distribution = 'curdzz'
    wheel.version = '0.1.2'
    wheel.build = '1'
    wheel.tags.pyver = 'py27'
    wheel.tags.abi = None
    wheel.tags.arch = None

    # Then I see that the tags property was properly filled out as well
    dict(wheel.tags).should.equal({
        'pyver': 'py27',
        'abi': None,
        'arch': None,
    })

    # And when I generate the file name; Then I see that it uses all
    # the previously associated metadata
    wheel.name().should.equal('curdzz-0.1.2-1-py27-none-any')
コード例 #2
0
def test_read_wheel_file():
    "Wheel.read_wheel_file() Should parse the WHEEL file of an archive into a dictionary"

    # Given the following WHEEL file of a fake archive
    archive = Mock()
    archive.read.return_value = b'''\
Wheel-Version: 1.0
Generator: bdist_wheel (0.21.0)
Root-Is-Purelib: true
Tag: py27-none-any
Tag: py3-none-any
'''

    # When it is parsed
    information = Wheel().read_wheel_file(archive)

    # Then I see that the information was parsed correctly
    information.should.equal({
        'Wheel-Version': '1.0',
        'Generator': 'bdist_wheel (0.21.0)',
        'Root-Is-Purelib': 'true',
        'Tag': ['py27-none-any', 'py3-none-any']
    })