is_system_path: return False if path is None (#28403)
This commit is contained in:
parent
7e3677db6f
commit
f238835b65
@ -22,6 +22,8 @@ def prepare_environment_for_tests():
|
|||||||
def test_is_system_path():
|
def test_is_system_path():
|
||||||
assert(envutil.is_system_path('/usr/bin'))
|
assert(envutil.is_system_path('/usr/bin'))
|
||||||
assert(not envutil.is_system_path('/nonsense_path/bin'))
|
assert(not envutil.is_system_path('/nonsense_path/bin'))
|
||||||
|
assert(not envutil.is_system_path(''))
|
||||||
|
assert(not envutil.is_system_path(None))
|
||||||
|
|
||||||
|
|
||||||
test_paths = ['/usr/bin',
|
test_paths = ['/usr/bin',
|
||||||
|
@ -59,7 +59,7 @@ def is_system_path(path):
|
|||||||
Returns:
|
Returns:
|
||||||
True or False
|
True or False
|
||||||
"""
|
"""
|
||||||
return os.path.normpath(path) in system_dirs
|
return path and os.path.normpath(path) in system_dirs
|
||||||
|
|
||||||
|
|
||||||
def filter_system_paths(paths):
|
def filter_system_paths(paths):
|
||||||
|
Loading…
Reference in New Issue
Block a user