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

Function test_additional_dependencies_roll_forward

tests/repository_test.py:166–183  ·  view source on GitHub ↗
(tempdir_factory, store)

Source from the content-addressed store, hash-verified

164
165
166def test_additional_dependencies_roll_forward(tempdir_factory, store):
167 path = make_repo(tempdir_factory, 'python_hooks_repo')
168
169 config1 = make_config_from_repo(path)
170 hook1 = _get_hook(config1, store, 'foo')
171 with python.in_env(hook1.prefix, hook1.language_version):
172 assert 'mccabe' not in cmd_output('pip', 'freeze', '-l')[1]
173
174 # Make another repo with additional dependencies
175 config2 = make_config_from_repo(path)
176 config2['hooks'][0]['additional_dependencies'] = ['mccabe']
177 hook2 = _get_hook(config2, store, 'foo')
178 with python.in_env(hook2.prefix, hook2.language_version):
179 assert 'mccabe' in cmd_output('pip', 'freeze', '-l')[1]
180
181 # should not have affected original
182 with python.in_env(hook1.prefix, hook1.language_version):
183 assert 'mccabe' not in cmd_output('pip', 'freeze', '-l')[1]
184
185
186@pytest.mark.parametrize('v', ('v1', 'v2'))

Callers

nothing calls this directly

Calls 5

make_repoFunction · 0.90
make_config_from_repoFunction · 0.90
cmd_outputFunction · 0.90
_get_hookFunction · 0.85
in_envMethod · 0.80

Tested by

no test coverage detected