(tempdir_factory, store)
| 266 | |
| 267 | |
| 268 | def test_invalidated_virtualenv(tempdir_factory, store): |
| 269 | # A cached virtualenv may become invalidated if the system python upgrades |
| 270 | # This should not cause every hook in that virtualenv to fail. |
| 271 | path = make_repo(tempdir_factory, 'python_hooks_repo') |
| 272 | config = make_config_from_repo(path) |
| 273 | hook = _get_hook(config, store, 'foo') |
| 274 | |
| 275 | # Simulate breaking of the virtualenv |
| 276 | envdir = lang_base.environment_dir( |
| 277 | hook.prefix, |
| 278 | python.ENVIRONMENT_DIR, |
| 279 | hook.language_version, |
| 280 | ) |
| 281 | libdir = os.path.join(envdir, 'lib', hook.language_version) |
| 282 | paths = [ |
| 283 | os.path.join(libdir, p) for p in ('site.py', 'site.pyc', '__pycache__') |
| 284 | ] |
| 285 | cmd_output_b('rm', '-rf', *paths) |
| 286 | |
| 287 | # pre-commit should rebuild the virtualenv and it should be runnable |
| 288 | hook = _get_hook(config, store, 'foo') |
| 289 | ret, out = _hook_run(hook, (), color=False) |
| 290 | assert ret == 0 |
| 291 | |
| 292 | |
| 293 | def test_really_long_file_paths(tempdir_factory, store): |
nothing calls this directly
no test coverage detected