diff options
Diffstat (limited to 'git/test/test_index.py')
-rw-r--r-- | git/test/test_index.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/git/test/test_index.py b/git/test/test_index.py index ca877838..178a59d2 100644 --- a/git/test/test_index.py +++ b/git/test/test_index.py @@ -135,6 +135,25 @@ class TestIndex(TestBase): raise AssertionError("CMP Failed: Missing entries in index: %s, missing in tree: %s" % (bset - iset, iset - bset)) # END assertion message + + @with_rw_repo('0.1.6') + def test_index_lock_handling(self, rw_repo): + def add_bad_blob(): + rw_repo.index.add([Blob(rw_repo, b'f' * 20, 'bad-permissions', 'foo')]) + + try: + ## 1st fail on purpose adding into index. + add_bad_blob() + except Exception as ex: + msg_py3 = "required argument is not an integer" + msg_py2 = "cannot convert argument to integer" + assert msg_py2 in str(ex) or msg_py3 in str(ex) + + ## 2nd time should not fail due to stray lock file + try: + add_bad_blob() + except Exception as ex: + assert "index.lock' could not be obtained" not in str(ex) @with_rw_repo('0.1.6') def test_index_file_from_tree(self, rw_repo): |