Skip to content

Commit

Permalink
Merge pull request #1178 from idoru/improve-requirements-gen-test-and…
Browse files Browse the repository at this point in the history
…-factoring

Improve test & code clarity around requirements generation
  • Loading branch information
kennethreitz committed Dec 18, 2017
2 parents 376896f + b704908 commit 3496a7a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
13 changes: 3 additions & 10 deletions pipenv/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ def cleanup_procs(procs, concurrent):
# Allow pip to resolve dependencies when in skip-lock mode.
no_deps = (not skip_lock)

deps_list, dev_deps_list = merge_deps(
deps_list, requirements_deps_list = merge_deps(
lockfile,
project,
dev=dev,
Expand All @@ -797,15 +797,8 @@ def cleanup_procs(procs, concurrent):
)
failed_deps_list = []
if requirements:
# Output only default dependencies
if not dev:
click.echo('\n'.join(d[0] for d in deps_list))
sys.exit(0)

# Output only dev dependencies
if dev:
click.echo('\n'.join(d[0] for d in dev_deps_list))
sys.exit(0)
click.echo('\n'.join(d[0] for d in requirements_deps_list))
sys.exit(0)

procs = []

Expand Down
2 changes: 1 addition & 1 deletion pipenv/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ def merge_deps(file_dict, project, dev=False, requirements=False, ignore_hashes=
include_index = True if not suffix else False
converted = convert_deps_to_pip(file_dict[section], project, r=False, include_index=include_index)
deps.extend((d, no_hashes, block) for d in converted)
if dev and is_dev and requirements:
if requirements and dev == is_dev:
requirements_deps.extend((d, no_hashes, block) for d in converted)
return deps, requirements_deps

Expand Down
3 changes: 2 additions & 1 deletion tests/test_pipenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ def test_lock_requirements_file(self):

req_list = ("requests==2.14.0", "flask==0.12.2")

dev_req_list = ("pytest==3.1.1")
dev_req_list = ("pytest==3.1.1",)

c = p.pipenv('lock -r')
d = p.pipenv('lock -r -d')
Expand All @@ -839,6 +839,7 @@ def test_lock_requirements_file(self):
assert req in c.out

for req in dev_req_list:
assert req not in c.out
assert req in d.out

@pytest.mark.lock
Expand Down

0 comments on commit 3496a7a

Please sign in to comment.