-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6303 from cjerdonek/issue-5749-no-cache-dir
Whether to build wheels is no longer affected by --no-cache-dir.
- Loading branch information
Showing
3 changed files
with
113 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
For consistency, passing ``--no-cache-dir`` no longer affects whether wheels | ||
will be built. In this case, a temporary directory is used. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
from mock import Mock, call, patch | ||
|
||
from pip._internal.commands.install import build_wheels | ||
|
||
|
||
class TestWheelCache: | ||
|
||
def check_build_wheels( | ||
self, | ||
pep517_requirements, | ||
legacy_requirements, | ||
session, | ||
): | ||
""" | ||
Return: (mock_calls, return_value). | ||
""" | ||
def build(reqs, **kwargs): | ||
# Fail the first requirement. | ||
return [reqs[0]] | ||
|
||
builder = Mock() | ||
builder.build.side_effect = build | ||
|
||
build_failures = build_wheels( | ||
builder=builder, | ||
pep517_requirements=pep517_requirements, | ||
legacy_requirements=legacy_requirements, | ||
# A session value isn't needed. | ||
session='<session>', | ||
) | ||
|
||
return (builder.build.mock_calls, build_failures) | ||
|
||
@patch('pip._internal.commands.install.is_wheel_installed') | ||
def test_build_wheels__wheel_installed(self, is_wheel_installed): | ||
is_wheel_installed.return_value = True | ||
|
||
mock_calls, build_failures = self.check_build_wheels( | ||
pep517_requirements=['a', 'b'], | ||
legacy_requirements=['c', 'd'], | ||
session='<session>', | ||
) | ||
|
||
# Legacy requirements were built. | ||
assert mock_calls == [ | ||
call(['a', 'b'], autobuilding=True, session='<session>'), | ||
call(['c', 'd'], autobuilding=True, session='<session>'), | ||
] | ||
|
||
# Legacy build failures are not included in the return value. | ||
assert build_failures == ['a'] | ||
|
||
@patch('pip._internal.commands.install.is_wheel_installed') | ||
def test_build_wheels__wheel_not_installed(self, is_wheel_installed): | ||
is_wheel_installed.return_value = False | ||
|
||
mock_calls, build_failures = self.check_build_wheels( | ||
pep517_requirements=['a', 'b'], | ||
legacy_requirements=['c', 'd'], | ||
session='<session>', | ||
) | ||
|
||
# Legacy requirements were not built. | ||
assert mock_calls == [ | ||
call(['a', 'b'], autobuilding=True, session='<session>'), | ||
] | ||
|
||
assert build_failures == ['a'] |