MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / _path_without_us

Function _path_without_us

tests/commands/install_uninstall_test.py:248–262  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

246
247
248def _path_without_us():
249 # Choose a path which *probably* doesn't include us
250 env = dict(os.environ)
251 exe = find_executable('pre-commit', env=env)
252 while exe:
253 parts = env['PATH'].split(os.pathsep)
254 after = [
255 x for x in parts
256 if x.lower().rstrip(os.sep) != os.path.dirname(exe).lower()
257 ]
258 if parts == after:
259 raise AssertionError(exe, parts)
260 env['PATH'] = os.pathsep.join(after)
261 exe = find_executable('pre-commit', env=env)
262 return env['PATH']
263
264
265def test_environment_not_sourced(tempdir_factory, store):

Callers 2

test_installed_from_venvFunction · 0.85

Calls 1

find_executableFunction · 0.90

Tested by

no test coverage detected