-
-
Notifications
You must be signed in to change notification settings - Fork 611
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 #476 from mattlong/ISSUE-446
Keep second-level requirements for editable reqs after round one
- Loading branch information
Showing
5 changed files
with
93 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,3 @@ | ||
[flake8] | ||
max-line-length = 120 | ||
exclude = build/*, dist/*, pip_tools.egg-info/* |
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
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,9 @@ | ||
from setuptools import setup | ||
|
||
setup( | ||
name='small_fake_with_deps', | ||
version=0.1, | ||
install_requires=[ | ||
"six==1.10.0", | ||
], | ||
) |
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,46 @@ | ||
import os | ||
import pytest | ||
|
||
from piptools.repositories import PyPIRepository | ||
from piptools.scripts.compile import get_pip_command | ||
|
||
|
||
class MockedPyPIRepository(PyPIRepository): | ||
def get_dependencies(self, ireq): | ||
# "mock" everything but editable reqs to avoid disk and network I/O | ||
# when possible | ||
if not ireq.editable: | ||
return set() | ||
|
||
return super(MockedPyPIRepository, self).get_dependencies(ireq) | ||
|
||
|
||
def _get_repository(): | ||
pip_command = get_pip_command() | ||
pip_args = [] | ||
pip_options, _ = pip_command.parse_args(pip_args) | ||
session = pip_command._build_session(pip_options) | ||
repository = MockedPyPIRepository(pip_options, session) | ||
return repository | ||
|
||
|
||
@pytest.mark.parametrize( | ||
('input', 'expected'), | ||
((tup) for tup in [ | ||
([os.path.join(os.path.dirname(__file__), 'fixtures', 'small_fake_package')], | ||
['six']), | ||
]) | ||
) | ||
def test_editable_top_level_deps_preserved(base_resolver, repository, from_editable, input, expected): | ||
input = [from_editable(line) for line in input] | ||
repository = _get_repository() | ||
output = base_resolver(input, prereleases=False, repository=repository).resolve() | ||
|
||
output = set([p.name for p in output]) | ||
|
||
# sanity check that we're expecting something | ||
assert output != set() | ||
|
||
for package_name in expected: | ||
assert package_name in output |