Do not crash in staged_files_only if patch_dir does not exist

This commit is contained in:
Anthony Sottile 2017-09-17 15:22:48 -07:00
parent 773a817f7f
commit bcf6321bd4
2 changed files with 11 additions and 0 deletions

View file

@ -75,6 +75,15 @@ def test_foo_something_unstaged(foo_staged, patch_dir):
_test_foo_state(foo_staged, 'herp\nderp\n', 'AM')
def test_does_not_crash_patch_dir_does_not_exist(foo_staged, patch_dir):
with io.open(foo_staged.foo_filename, 'w') as foo_file:
foo_file.write('hello\nworld\n')
shutil.rmtree(patch_dir)
with staged_files_only(patch_dir):
pass
def test_something_unstaged_ext_diff_tool(foo_staged, patch_dir, tmpdir):
diff_tool = tmpdir.join('diff-tool.sh')
diff_tool.write('#!/usr/bin/env bash\necho "$@"\n')