Skip to content

Commit ee51dc5

Browse files
committed
switch from python_hooks_repo to inline bash in autoupdate fixture
a lil WET and sloppy, but hoping it makes windows testing faster
1 parent df2cada commit ee51dc5

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

tests/commands/autoupdate_test.py

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,40 @@
2626

2727

2828
@pytest.fixture
29-
def up_to_date(tempdir_factory):
30-
yield make_repo(tempdir_factory, 'python_hooks_repo')
29+
def up_to_date(tmp_path):
30+
path = str(tmp_path)
31+
cmd_output('git', 'init', path)
32+
manifest = '''\
33+
- id: foo
34+
name: Foo
35+
entry: foo.sh
36+
language: script
37+
files: ''
38+
'''
39+
tmp_path.joinpath('foo.sh').write_text('#!/usr/bin/env bash\necho "Hi!"')
40+
tmp_path.joinpath(C.MANIFEST_FILE).write_text(manifest)
41+
42+
cmd_output('git', 'add', '.', cwd=path)
43+
git_commit(msg='make_repo', cwd=path)
44+
yield path
3145

3246

3347
@pytest.fixture
34-
def out_of_date(tempdir_factory):
35-
path = make_repo(tempdir_factory, 'python_hooks_repo')
48+
def out_of_date(tmp_path):
49+
path = str(tmp_path)
50+
cmd_output('git', 'init', path)
51+
manifest = '''\
52+
- id: foo
53+
name: Foo
54+
entry: foo.sh
55+
language: script
56+
files: ''
57+
'''
58+
tmp_path.joinpath('foo.sh').write_text('#!/usr/bin/env bash\necho "Hi!"')
59+
tmp_path.joinpath(C.MANIFEST_FILE).write_text(manifest)
60+
61+
cmd_output('git', 'add', '.', cwd=path)
62+
git_commit(msg='make_repo', cwd=path)
3663
original_rev = git.head_rev(path)
3764

3865
git_commit(cwd=path)
@@ -420,7 +447,7 @@ def test_autoupdate_latest_no_config(out_of_date, in_tmpdir, store):
420447
assert out_of_date.original_rev in f.read()
421448

422449

423-
def test_hook_disppearing_repo_raises(hook_disappearing, store):
450+
def test_hook_disappearing_repo_raises(hook_disappearing, store):
424451
config = make_config_from_repo(
425452
hook_disappearing.path,
426453
rev=hook_disappearing.original_rev,

0 commit comments

Comments
 (0)