()
| 246 | |
| 247 | |
| 248 | def _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 | |
| 265 | def test_environment_not_sourced(tempdir_factory, store): |
no test coverage detected