git grep -l tmpdir_factory | xargs sed -i 's/tmpdir_factory/tempdir_factory/g'

This commit is contained in:
Anthony Sottile 2015-10-01 10:24:25 -07:00
parent 5791d84236
commit 1dfcf10036
14 changed files with 199 additions and 199 deletions

View file

@ -29,7 +29,7 @@ from testing.util import xfailif_windows_no_ruby
def _test_hook_repo(
tmpdir_factory,
tempdir_factory,
store,
repo_path,
hook_id,
@ -38,7 +38,7 @@ def _test_hook_repo(
expected_return_code=0,
config_kwargs=None
):
path = make_repo(tmpdir_factory, repo_path)
path = make_repo(tempdir_factory, repo_path)
config = make_config_from_repo(path, **(config_kwargs or {}))
repo = Repository.create(config, store)
hook_dict = [
@ -50,18 +50,18 @@ def _test_hook_repo(
@pytest.mark.integration
def test_python_hook(tmpdir_factory, store):
def test_python_hook(tempdir_factory, store):
_test_hook_repo(
tmpdir_factory, store, 'python_hooks_repo',
tempdir_factory, store, 'python_hooks_repo',
'foo', [os.devnull],
b"['" + five.to_bytes(os.devnull) + b"']\nHello World\n"
)
@pytest.mark.integration
def test_python_hook_args_with_spaces(tmpdir_factory, store):
def test_python_hook_args_with_spaces(tempdir_factory, store):
_test_hook_repo(
tmpdir_factory, store, 'python_hooks_repo',
tempdir_factory, store, 'python_hooks_repo',
'foo',
[],
b"['i have spaces', 'and\"\\'quotes', '$and !this']\n"
@ -76,9 +76,9 @@ def test_python_hook_args_with_spaces(tmpdir_factory, store):
@pytest.mark.integration
def test_switch_language_versions_doesnt_clobber(tmpdir_factory, store):
def test_switch_language_versions_doesnt_clobber(tempdir_factory, store):
# We're using the python3 repo because it prints the python version
path = make_repo(tmpdir_factory, 'python3_hooks_repo')
path = make_repo(tempdir_factory, 'python3_hooks_repo')
def run_on_version(version, expected_output):
config = make_config_from_repo(
@ -99,9 +99,9 @@ def test_switch_language_versions_doesnt_clobber(tmpdir_factory, store):
@pytest.mark.integration
def test_versioned_python_hook(tmpdir_factory, store):
def test_versioned_python_hook(tempdir_factory, store):
_test_hook_repo(
tmpdir_factory, store, 'python3_hooks_repo',
tempdir_factory, store, 'python3_hooks_repo',
'python3-hook',
[os.devnull],
b"3.3\n['" + five.to_bytes(os.devnull) + b"']\nHello World\n",
@ -111,9 +111,9 @@ def test_versioned_python_hook(tmpdir_factory, store):
@skipif_slowtests_false
@xfailif_windows_no_node
@pytest.mark.integration
def test_run_a_node_hook(tmpdir_factory, store):
def test_run_a_node_hook(tempdir_factory, store):
_test_hook_repo(
tmpdir_factory, store, 'node_hooks_repo',
tempdir_factory, store, 'node_hooks_repo',
'foo', ['/dev/null'], b'Hello World\n',
)
@ -121,9 +121,9 @@ def test_run_a_node_hook(tmpdir_factory, store):
@skipif_slowtests_false
@xfailif_windows_no_node
@pytest.mark.integration
def test_run_versioned_node_hook(tmpdir_factory, store):
def test_run_versioned_node_hook(tempdir_factory, store):
_test_hook_repo(
tmpdir_factory, store, 'node_0_11_8_hooks_repo',
tempdir_factory, store, 'node_0_11_8_hooks_repo',
'node-11-8-hook', ['/dev/null'], b'v0.11.8\nHello World\n',
)
@ -131,9 +131,9 @@ def test_run_versioned_node_hook(tmpdir_factory, store):
@skipif_slowtests_false
@xfailif_windows_no_ruby
@pytest.mark.integration
def test_run_a_ruby_hook(tmpdir_factory, store):
def test_run_a_ruby_hook(tempdir_factory, store):
_test_hook_repo(
tmpdir_factory, store, 'ruby_hooks_repo',
tempdir_factory, store, 'ruby_hooks_repo',
'ruby_hook', ['/dev/null'], b'Hello world from a ruby hook\n',
)
@ -141,9 +141,9 @@ def test_run_a_ruby_hook(tmpdir_factory, store):
@skipif_slowtests_false
@xfailif_windows_no_ruby
@pytest.mark.integration
def test_run_versioned_ruby_hook(tmpdir_factory, store):
def test_run_versioned_ruby_hook(tempdir_factory, store):
_test_hook_repo(
tmpdir_factory, store, 'ruby_1_9_3_hooks_repo',
tempdir_factory, store, 'ruby_1_9_3_hooks_repo',
'ruby_hook',
['/dev/null'],
b'1.9.3\n484\nHello world from a ruby hook\n',
@ -151,25 +151,25 @@ def test_run_versioned_ruby_hook(tmpdir_factory, store):
@pytest.mark.integration
def test_system_hook_with_spaces(tmpdir_factory, store):
def test_system_hook_with_spaces(tempdir_factory, store):
_test_hook_repo(
tmpdir_factory, store, 'system_hook_with_spaces_repo',
tempdir_factory, store, 'system_hook_with_spaces_repo',
'system-hook-with-spaces', ['/dev/null'], b'Hello World\n',
)
@pytest.mark.integration
def test_run_a_script_hook(tmpdir_factory, store):
def test_run_a_script_hook(tempdir_factory, store):
_test_hook_repo(
tmpdir_factory, store, 'script_hooks_repo',
tempdir_factory, store, 'script_hooks_repo',
'bash_hook', ['bar'], b'bar\nHello World\n',
)
@pytest.mark.integration
def test_run_hook_with_spaced_args(tmpdir_factory, store):
def test_run_hook_with_spaced_args(tempdir_factory, store):
_test_hook_repo(
tmpdir_factory, store, 'arg_per_line_hooks_repo',
tempdir_factory, store, 'arg_per_line_hooks_repo',
'arg-per-line',
['foo bar', 'baz'],
b'arg: hello\narg: world\narg: foo bar\narg: baz\n',
@ -178,8 +178,8 @@ def test_run_hook_with_spaced_args(tmpdir_factory, store):
@xfailif_no_pcre_support
@pytest.mark.integration
def test_pcre_hook_no_match(tmpdir_factory, store):
path = git_dir(tmpdir_factory)
def test_pcre_hook_no_match(tempdir_factory, store):
path = git_dir(tempdir_factory)
with cwd(path):
with io.open('herp', 'w') as herp:
herp.write('foo')
@ -188,20 +188,20 @@ def test_pcre_hook_no_match(tmpdir_factory, store):
derp.write('bar')
_test_hook_repo(
tmpdir_factory, store, 'pcre_hooks_repo',
tempdir_factory, store, 'pcre_hooks_repo',
'regex-with-quotes', ['herp', 'derp'], b'',
)
_test_hook_repo(
tmpdir_factory, store, 'pcre_hooks_repo',
tempdir_factory, store, 'pcre_hooks_repo',
'other-regex', ['herp', 'derp'], b'',
)
@xfailif_no_pcre_support
@pytest.mark.integration
def test_pcre_hook_matching(tmpdir_factory, store):
path = git_dir(tmpdir_factory)
def test_pcre_hook_matching(tempdir_factory, store):
path = git_dir(tempdir_factory)
with cwd(path):
with io.open('herp', 'w') as herp:
herp.write("\nherpfoo'bard\n")
@ -210,13 +210,13 @@ def test_pcre_hook_matching(tmpdir_factory, store):
derp.write('[INFO] information yo\n')
_test_hook_repo(
tmpdir_factory, store, 'pcre_hooks_repo',
tempdir_factory, store, 'pcre_hooks_repo',
'regex-with-quotes', ['herp', 'derp'], b"herp:2:herpfoo'bard\n",
expected_return_code=123,
)
_test_hook_repo(
tmpdir_factory, store, 'pcre_hooks_repo',
tempdir_factory, store, 'pcre_hooks_repo',
'other-regex', ['herp', 'derp'], b'derp:1:[INFO] information yo\n',
expected_return_code=123,
)
@ -224,17 +224,17 @@ def test_pcre_hook_matching(tmpdir_factory, store):
@xfailif_no_pcre_support
@pytest.mark.integration
def test_pcre_many_files(tmpdir_factory, store):
def test_pcre_many_files(tempdir_factory, store):
# This is intended to simulate lots of passing files and one failing file
# to make sure it still fails. This is not the case when naively using
# a system hook with `grep -H -n '...'` and expected_return_code=123.
path = git_dir(tmpdir_factory)
path = git_dir(tempdir_factory)
with cwd(path):
with io.open('herp', 'w') as herp:
herp.write('[INFO] info\n')
_test_hook_repo(
tmpdir_factory, store, 'pcre_hooks_repo',
tempdir_factory, store, 'pcre_hooks_repo',
'other-regex',
['/dev/null'] * 15000 + ['herp'],
b'herp:1:[INFO] info\n',
@ -252,20 +252,20 @@ def _norm_pwd(path):
@pytest.mark.integration
def test_cwd_of_hook(tmpdir_factory, store):
def test_cwd_of_hook(tempdir_factory, store):
# Note: this doubles as a test for `system` hooks
path = git_dir(tmpdir_factory)
path = git_dir(tempdir_factory)
with cwd(path):
_test_hook_repo(
tmpdir_factory, store, 'prints_cwd_repo',
tempdir_factory, store, 'prints_cwd_repo',
'prints_cwd', ['-L'], _norm_pwd(path) + b'\n',
)
@pytest.mark.integration
def test_lots_of_files(tmpdir_factory, store):
def test_lots_of_files(tempdir_factory, store):
_test_hook_repo(
tmpdir_factory, store, 'script_hooks_repo',
tempdir_factory, store, 'script_hooks_repo',
'bash_hook', ['/dev/null'] * 15000, mock.ANY,
)
@ -296,15 +296,15 @@ def test_sha(mock_repo_config):
@pytest.mark.integration
def test_languages(tmpdir_factory, store):
path = make_repo(tmpdir_factory, 'python_hooks_repo')
def test_languages(tempdir_factory, store):
path = make_repo(tempdir_factory, 'python_hooks_repo')
config = make_config_from_repo(path)
repo = Repository.create(config, store)
assert repo.languages == set([('python', 'default')])
def test_reinstall(tmpdir_factory, store, log_info_mock):
path = make_repo(tmpdir_factory, 'python_hooks_repo')
def test_reinstall(tempdir_factory, store, log_info_mock):
path = make_repo(tempdir_factory, 'python_hooks_repo')
config = make_config_from_repo(path)
repo = Repository.create(config, store)
repo.require_installed()
@ -320,9 +320,9 @@ def test_reinstall(tmpdir_factory, store, log_info_mock):
assert log_info_mock.call_count == 0
def test_control_c_control_c_on_install(tmpdir_factory, store):
def test_control_c_control_c_on_install(tempdir_factory, store):
"""Regression test for #186."""
path = make_repo(tmpdir_factory, 'python_hooks_repo')
path = make_repo(tempdir_factory, 'python_hooks_repo')
config = make_config_from_repo(path)
repo = Repository.create(config, store)
hook = repo.hooks[0][1]
@ -352,12 +352,12 @@ def test_control_c_control_c_on_install(tmpdir_factory, store):
@pytest.mark.integration
def test_really_long_file_paths(tmpdir_factory, store):
base_path = tmpdir_factory.get()
def test_really_long_file_paths(tempdir_factory, store):
base_path = tempdir_factory.get()
really_long_path = os.path.join(base_path, 'really_long' * 10)
cmd_output('git', 'init', really_long_path)
path = make_repo(tmpdir_factory, 'python_hooks_repo')
path = make_repo(tempdir_factory, 'python_hooks_repo')
config = make_config_from_repo(path)
with cwd(really_long_path):
@ -366,8 +366,8 @@ def test_really_long_file_paths(tmpdir_factory, store):
@pytest.mark.integration
def test_config_overrides_repo_specifics(tmpdir_factory, store):
path = make_repo(tmpdir_factory, 'script_hooks_repo')
def test_config_overrides_repo_specifics(tempdir_factory, store):
path = make_repo(tempdir_factory, 'script_hooks_repo')
config = make_config_from_repo(path)
repo = Repository.create(config, store)
@ -378,19 +378,19 @@ def test_config_overrides_repo_specifics(tmpdir_factory, store):
assert repo.hooks[0][1]['files'] == '\\.sh$'
def _create_repo_with_tags(tmpdir_factory, src, tag):
path = make_repo(tmpdir_factory, src)
def _create_repo_with_tags(tempdir_factory, src, tag):
path = make_repo(tempdir_factory, src)
with cwd(path):
cmd_output('git', 'tag', tag)
return path
@pytest.mark.integration
def test_tags_on_repositories(in_tmpdir, tmpdir_factory, store):
def test_tags_on_repositories(in_tmpdir, tempdir_factory, store):
tag = 'v1.1'
git_dir_1 = _create_repo_with_tags(tmpdir_factory, 'prints_cwd_repo', tag)
git_dir_1 = _create_repo_with_tags(tempdir_factory, 'prints_cwd_repo', tag)
git_dir_2 = _create_repo_with_tags(
tmpdir_factory, 'script_hooks_repo', tag,
tempdir_factory, 'script_hooks_repo', tag,
)
repo_1 = Repository.create(