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

Function test_installed_from_venv

tests/commands/install_uninstall_test.py:526–550  ·  view source on GitHub ↗
(tempdir_factory, store)

Source from the content-addressed store, hash-verified

524
525
526def test_installed_from_venv(tempdir_factory, store):
527 path = make_consuming_repo(tempdir_factory, 'script_hooks_repo')
528 with cwd(path):
529 install(C.CONFIG_FILE, store, hook_types=['pre-commit'])
530 # No environment so pre-commit is not on the path when running!
531 # Should still pick up the python from when we installed
532 ret, output = _get_commit_output(
533 tempdir_factory,
534 env={
535 'HOME': os.path.expanduser('~'),
536 'PATH': _path_without_us(),
537 'TERM': os.environ.get('TERM', ''),
538 # Windows needs this to import `random`
539 'SYSTEMROOT': os.environ.get('SYSTEMROOT', ''),
540 # Windows needs this to resolve executables
541 'PATHEXT': os.environ.get('PATHEXT', ''),
542 # Git needs this to make a commit
543 'GIT_AUTHOR_NAME': os.environ['GIT_AUTHOR_NAME'],
544 'GIT_COMMITTER_NAME': os.environ['GIT_COMMITTER_NAME'],
545 'GIT_AUTHOR_EMAIL': os.environ['GIT_AUTHOR_EMAIL'],
546 'GIT_COMMITTER_EMAIL': os.environ['GIT_COMMITTER_EMAIL'],
547 },
548 )
549 assert ret == 0
550 NORMAL_PRE_COMMIT_RUN.assert_matches(output)
551
552
553def _get_push_output(tempdir_factory, remote='origin', opts=()):

Callers

nothing calls this directly

Calls 6

make_consuming_repoFunction · 0.90
cwdFunction · 0.90
installFunction · 0.90
_get_commit_outputFunction · 0.85
_path_without_usFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected