-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Implements reqs command * Add news document * Process comments * Rename newsfile * Adds --dev-only and --hash args * Linting fixes Co-authored-by: Imre Persoonlijk <imre1@pop-os.localdomain>
- Loading branch information
Showing
6 changed files
with
157 additions
and
16 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
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 @@ | ||
Implements a ``pipenv requirements`` command which generates a requirements.txt compatible output without locking. |
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 @@ | ||
import pytest | ||
|
||
|
||
@pytest.mark.requirements | ||
def test_requirements_generates_requirements_from_lockfile(PipenvInstance): | ||
with PipenvInstance(chdir=True) as p: | ||
packages = ('requests', '2.14.0') | ||
dev_packages = ('flask', '0.12.2') | ||
with open(p.pipfile_path, 'w') as f: | ||
contents = f""" | ||
[packages] | ||
{packages[0]}= "=={packages[1]}" | ||
[dev-packages] | ||
{dev_packages[0]}= "=={dev_packages[1]}" | ||
""".strip() | ||
f.write(contents) | ||
p.pipenv('lock') | ||
c = p.pipenv('requirements') | ||
assert c.returncode == 0 | ||
assert f'{packages[0]}=={packages[1]}' in c.stdout | ||
assert f'{dev_packages[0]}=={dev_packages[1]}' not in c.stdout | ||
|
||
d = p.pipenv('requirements --dev') | ||
assert d.returncode == 0 | ||
assert f'{packages[0]}=={packages[1]}' in d.stdout | ||
assert f'{dev_packages[0]}=={dev_packages[1]}' in d.stdout | ||
|
||
e = p.pipenv('requirements --dev-only') | ||
assert e.returncode == 0 | ||
assert f'{packages[0]}=={packages[1]}' not in e.stdout | ||
assert f'{dev_packages[0]}=={dev_packages[1]}' in e.stdout | ||
|
||
e = p.pipenv('requirements --hash') | ||
assert e.returncode == 0 | ||
assert f'{packages[0]}=={packages[1]}' in e.stdout | ||
for value in p.lockfile['default'].values(): | ||
for hash in value['hashes']: | ||
assert f' --hash={hash}' in e.stdout | ||
|
||
|
||
@pytest.mark.requirements | ||
def test_requirements_generates_requirements_from_lockfile_multiple_sources(PipenvInstance): | ||
with PipenvInstance(chdir=True) as p: | ||
packages = ('requests', '2.14.0') | ||
dev_packages = ('flask', '0.12.2') | ||
with open(p.pipfile_path, 'w') as f: | ||
contents = f""" | ||
[[source]] | ||
name = "pypi" | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
[[source]] | ||
name = "other_source" | ||
url = "https://some_other_source.org" | ||
verify_ssl = true | ||
[packages] | ||
{packages[0]}= "=={packages[1]}" | ||
[dev-packages] | ||
{dev_packages[0]}= "=={dev_packages[1]}" | ||
""".strip() | ||
f.write(contents) | ||
l = p.pipenv('lock') | ||
assert l.returncode == 0 | ||
c = p.pipenv('requirements') | ||
assert c.returncode == 0 | ||
|
||
assert '-i https://pypi.org/simple' in c.stdout | ||
assert '--extra-index-url https://some_other_source.org' in c.stdout |