Add pipfile env var expansion and test

- Fixes #1906

Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
Dan Ryan
2018-04-17 17:24:39 -04:00
parent 3c675bd3b6
commit 3722d8a8cf
2 changed files with 31 additions and 5 deletions
+24
View File
@@ -2,6 +2,30 @@
import pytest
import os
from pipenv.project import Project
from pipenv.utils import temp_environ
from pipenv.patched import pipfile
@pytest.mark.project
@pytest.mark.sources
@pytest.mark.environ
def test_pipfile_envvar_expansion(PipenvInstance):
with PipenvInstance(chdir=True) as p:
with temp_environ():
with open(p.pipfile_path, 'w') as f:
f.write("""
[[source]]
url = 'https://${TEST_HOST}/simple'
verify_ssl = false
name = "pypi"
[packages]
pytz = "*"
""".strip())
os.environ['TEST_HOST'] = 'localhost:5000'
project = Project()
assert project.sources[0]['url'] == 'https://localhost:5000/simple'
assert 'localhost:5000' not in str(pipfile.load(p.pipfile_path))
@pytest.mark.project