mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-16 02:21:46 +04:00
test for passing in python requirements files
This commit is contained in:
parent
15196678a5
commit
bace4f7dc9
1 changed files with 24 additions and 0 deletions
|
|
@ -482,6 +482,30 @@ def test_additional_python_dependencies_installed(tempdir_factory, store):
|
||||||
assert 'mccabe' in output
|
assert 'mccabe' in output
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.integration
|
||||||
|
def test_additional_python_dependencies_requirements_files(
|
||||||
|
tempdir_factory,
|
||||||
|
store
|
||||||
|
):
|
||||||
|
path = make_repo(tempdir_factory, 'python_hooks_repo')
|
||||||
|
config = make_config_from_repo(path)
|
||||||
|
|
||||||
|
# write pip requirements file
|
||||||
|
req_file_path = os.path.join(path, 'requirements.txt')
|
||||||
|
with io.open(req_file_path, 'w') as fp:
|
||||||
|
fp.write('pep8')
|
||||||
|
|
||||||
|
config['hooks'][0]['additional_dependencies'] = \
|
||||||
|
['mccabe', 'file:{}'.format(req_file_path)]
|
||||||
|
|
||||||
|
repo = Repository.create(config, store)
|
||||||
|
repo.require_installed()
|
||||||
|
with python.in_env(repo._cmd_runner, 'default'):
|
||||||
|
output = cmd_output('pip', 'freeze', '-l')[1]
|
||||||
|
assert 'mccabe' in output
|
||||||
|
assert 'pep8' in output
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.integration
|
@pytest.mark.integration
|
||||||
def test_additional_dependencies_roll_forward(tempdir_factory, store):
|
def test_additional_dependencies_roll_forward(tempdir_factory, store):
|
||||||
path = make_repo(tempdir_factory, 'python_hooks_repo')
|
path = make_repo(tempdir_factory, 'python_hooks_repo')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue