mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
fix _path_without_us under test when path segment ends in slash
This commit is contained in:
parent
0047fa35dd
commit
87dccbb8dc
1 changed files with 4 additions and 1 deletions
|
|
@ -259,7 +259,10 @@ def _path_without_us():
|
||||||
exe = find_executable('pre-commit', _environ=env)
|
exe = find_executable('pre-commit', _environ=env)
|
||||||
while exe:
|
while exe:
|
||||||
parts = env['PATH'].split(os.pathsep)
|
parts = env['PATH'].split(os.pathsep)
|
||||||
after = [x for x in parts if x.lower() != os.path.dirname(exe).lower()]
|
after = [
|
||||||
|
x for x in parts
|
||||||
|
if x.lower().rstrip(os.sep) != os.path.dirname(exe).lower()
|
||||||
|
]
|
||||||
if parts == after:
|
if parts == after:
|
||||||
raise AssertionError(exe, parts)
|
raise AssertionError(exe, parts)
|
||||||
env['PATH'] = os.pathsep.join(after)
|
env['PATH'] = os.pathsep.join(after)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue