mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 01:51:46 +04:00
Move test to install_uninstall test so environment variables apply
This commit is contained in:
parent
57cc814b8b
commit
0bb8a8fabe
6 changed files with 46 additions and 47 deletions
|
|
@ -456,8 +456,11 @@ def test_origin_source_error_msg_error(
|
|||
assert b'Specify both --origin and --source.' in printed
|
||||
|
||||
|
||||
def test_origin_source_both_ok(cap_out, store, repo_with_passing_hook):
|
||||
args = run_opts(origin='master', source='master')
|
||||
def test_all_push_options_ok(cap_out, store, repo_with_passing_hook):
|
||||
args = run_opts(
|
||||
origin='master', source='master',
|
||||
remote_name='origin', remote_url='https://example.com/repo',
|
||||
)
|
||||
ret, printed = _do_run(cap_out, store, repo_with_passing_hook, args)
|
||||
assert ret == 0
|
||||
assert b'Specify both --origin and --source.' not in printed
|
||||
|
|
@ -687,35 +690,6 @@ def test_stages(cap_out, store, repo_with_passing_hook):
|
|||
assert _run_for_stage('commit-msg').startswith(b'hook 5...')
|
||||
|
||||
|
||||
def test_push_remote_environment(cap_out, store, repo_with_passing_hook):
|
||||
config = {
|
||||
'repo': 'local',
|
||||
'hooks': [
|
||||
{
|
||||
'id': 'print-push-remote',
|
||||
'name': 'Print push remote name',
|
||||
'entry': 'entry: bash -c \'echo "$PRE_COMMIT_REMOTE_NAME"\'',
|
||||
'language': 'system',
|
||||
'verbose': bool(1),
|
||||
},
|
||||
],
|
||||
}
|
||||
add_config_to_repo(repo_with_passing_hook, config)
|
||||
|
||||
_test_run(
|
||||
cap_out,
|
||||
store,
|
||||
repo_with_passing_hook,
|
||||
opts={
|
||||
'push_remote_name': 'origin',
|
||||
'push_remote_url': 'https://github.com/pre-commit/pre-commit',
|
||||
},
|
||||
expected_outputs=[b'Print push remote name', b'Passed'],
|
||||
expected_ret=0,
|
||||
stage=['push'],
|
||||
)
|
||||
|
||||
|
||||
def test_commit_msg_hook(cap_out, store, commit_msg_repo):
|
||||
filename = '.git/COMMIT_EDITMSG'
|
||||
with open(filename, 'w') as f:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue