Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #31 from Yelp/wrong_wheel
Browse files Browse the repository at this point in the history
Fix wrong-wheel #28
  • Loading branch information
asottile committed Jan 12, 2015
2 parents db32501 + 6bd6b55 commit fea9833
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion tests/functional/simple_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def install_twice(tmpdir, between):
tmpdir.chdir()

# Arbitrary packages that takes a bit of time to install:
# Should I make a fixture c-extention to remove these dependencies?
# Should I make a fixture c-extension to remove these dependencies?
# NOTE: Avoid projects that use 2to3 (urwid). It makes the runtime vary too widely.
requirements('''\
simplejson==3.6.5
Expand Down Expand Up @@ -382,3 +382,16 @@ def test_args_backward(tmpdir):
assert Path('requirements.txt').isfile()
assert Path('requirements.txt').read() == ''
assert not Path('myvenv').exists()


def test_wrong_wheel(tmpdir):
tmpdir.chdir()

requirements('')
venv_update('venv1', 'requirements.txt', '-ppython2.7')
# A different python
# Before fixing, this would install argparse using the `py2-none-any`
# wheel, even on py3
ret2out, _ = venv_update('venv2', 'requirements.txt', '-ppython3.3')

assert 'py2-none-any' not in ret2out
2 changes: 1 addition & 1 deletion venv_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def faster_find_requirement(self, req, upgrade):
for link in glob(join(findlink, reqname + '-*.whl')):
link = Link('file://' + link)
wheel = Wheel(link.filename)
if wheel.version in req.req:
if wheel.version in req.req and wheel.supported():
return link

# otherwise, do the full network search
Expand Down

0 comments on commit fea9833

Please sign in to comment.