mirror of https://github.com/pypa/pip
Fix error trying to generate scripts warning when PATH not set
fixes #5558
This commit is contained in:
parent
c39a51003e
commit
ca5cca3426
|
@ -0,0 +1 @@
|
|||
Fix error trying to generate scripts warning when PATH not set
|
|
@ -163,7 +163,7 @@ def message_about_scripts_not_on_PATH(scripts):
|
|||
# We don't want to warn for directories that are on PATH.
|
||||
not_warn_dirs = [
|
||||
os.path.normcase(i).rstrip(os.sep) for i in
|
||||
os.environ["PATH"].split(os.pathsep)
|
||||
os.environ.get("PATH", "").split(os.pathsep)
|
||||
]
|
||||
# If an executable sits with sys.executable, we don't warn for it.
|
||||
# This covers the case of venv invocations without activating the venv.
|
||||
|
|
|
@ -470,3 +470,16 @@ class TestMessageAboutScriptsNotOnPATH(object):
|
|||
scripts=[os.path.join('a', 'b', 'c')]
|
||||
)
|
||||
assert retval is None
|
||||
|
||||
def test_missing_PATH_env_treated_as_empty_PATH_env(self):
|
||||
scripts = ['a/b/foo']
|
||||
|
||||
env = os.environ.copy()
|
||||
del env['PATH']
|
||||
with patch.dict('os.environ', env, clear=True):
|
||||
retval_missing = wheel.message_about_scripts_not_on_PATH(scripts)
|
||||
|
||||
with patch.dict('os.environ', {'PATH': ''}):
|
||||
retval_empty = wheel.message_about_scripts_not_on_PATH(scripts)
|
||||
|
||||
assert retval_missing == retval_empty
|
||||
|
|
Loading…
Reference in New Issue