mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Fix failures from missing pipfile before install
Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
@@ -223,13 +223,14 @@ class _PipenvInstance(object):
|
||||
os.umask(self.original_umask)
|
||||
|
||||
def pipenv(self, cmd, block=True):
|
||||
if self.pipfile_path:
|
||||
if self.pipfile_path and os.path.isfile(self.pipfile_path):
|
||||
os.environ['PIPENV_PIPFILE'] = fs_str(self.pipfile_path)
|
||||
# a bit of a hack to make sure the virtualenv is created
|
||||
|
||||
with TemporaryDirectory(prefix='pipenv-', suffix='-cache') as tempdir:
|
||||
os.environ['PIPENV_CACHE_DIR'] = fs_str(tempdir.name)
|
||||
c = delegator.run('pipenv {0}'.format(cmd), block=block)
|
||||
c = delegator.run('pipenv {0}'.format(cmd), block=block,
|
||||
cwd=os.path.abspath(self.path))
|
||||
if 'PIPENV_CACHE_DIR' in os.environ:
|
||||
del os.environ['PIPENV_CACHE_DIR']
|
||||
|
||||
|
||||
@@ -425,6 +425,8 @@ def test_install_creates_pipfile(PipenvInstance):
|
||||
with PipenvInstance(chdir=True) as p:
|
||||
if os.path.isfile(p.pipfile_path):
|
||||
os.unlink(p.pipfile_path)
|
||||
if "PIPENV_PIPFILE" in os.environ:
|
||||
del os.environ["PIPENV_PIPFILE"]
|
||||
assert not os.path.isfile(p.pipfile_path)
|
||||
c = p.pipenv("install")
|
||||
assert c.return_code == 0
|
||||
|
||||
Reference in New Issue
Block a user