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
Binary file not shown.
30 changes: 30 additions & 0 deletions tests/test_wheel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2015 Ian Cordasco
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import unicode_literals

from twine import wheel

import pytest


@pytest.fixture(params=[
'tests/fixtures/twine-1.5.0-py2.py3-none-any.whl',
'tests/alt-fixtures/twine-1.5.0-py2.py3-none-any.whl'
])
def example_wheel(request):
return wheel.Wheel(request.param)


def test_version_parsing(example_wheel):
assert example_wheel.py_version == 'py2.py3'
3 changes: 2 additions & 1 deletion twine/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ class Wheel(Distribution):

def __init__(self, filename, metadata_version=None):
self.filename = filename
self.basefilename = os.path.basename(self.filename)
self.metadata_version = metadata_version
self.extractMetadata()

@property
def py_version(self):
wheel_info = wheel_file_re.match(self.filename)
wheel_info = wheel_file_re.match(self.basefilename)
return wheel_info.group("pyver")

def read(self):
Expand Down