-
-
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.
Check lockfile exists on sync, and don't update it
Matching the behaviour mentioned in: #1463 (comment)
- Loading branch information
Showing
2 changed files
with
59 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import pytest | ||
|
||
|
||
@pytest.mark.sync | ||
def test_sync_error_without_lockfile(PipenvInstance, pypi): | ||
with PipenvInstance(pypi=pypi) as p: | ||
with open(p.pipfile_path, 'w') as f: | ||
f.write(""" | ||
[packages] | ||
""".strip()) | ||
|
||
c = p.pipenv('sync') | ||
assert c.return_code != 0 | ||
assert 'Pipfile.lock is missing!' in c.err | ||
|
||
|
||
@pytest.mark.sync | ||
@pytest.mark.lock | ||
def test_sync_should_not_lock(PipenvInstance, pypi): | ||
"""Sync should not touch the lock file, even if Pipfile is changed. | ||
""" | ||
with PipenvInstance(pypi=pypi) as p: | ||
with open(p.pipfile_path, 'w') as f: | ||
f.write(""" | ||
[packages] | ||
""".strip()) | ||
|
||
# Perform initial lock. | ||
c = p.pipenv('lock') | ||
assert c.return_code == 0 | ||
lockfile_content = p.lockfile | ||
assert lockfile_content | ||
|
||
# Make sure sync does not trigger lockfile update. | ||
with open(p.pipfile_path, 'w') as f: | ||
f.write(""" | ||
[packages] | ||
six = "*" | ||
""".strip()) | ||
c = p.pipenv('sync') | ||
assert c.return_code == 0 | ||
assert lockfile_content == p.lockfile |