diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2021-01-08 10:39:45 +0800 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2021-01-08 10:39:45 +0800 |
commit | d8cad756f357eb587f9f85f586617bff6d6c3ccf (patch) | |
tree | e811c28eff9147ed9033bc304724b6a2bab8317f /test/test_index.py | |
parent | 21e21d04bb216a1d7dc42b97bf6dc64864bb5968 (diff) | |
download | gitpython-d8cad756f357eb587f9f85f586617bff6d6c3ccf.tar.gz |
fix tests the fast way
Diffstat (limited to 'test/test_index.py')
-rw-r--r-- | test/test_index.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/test/test_index.py b/test/test_index.py index 1107f21d..02cb4e81 100644 --- a/test/test_index.py +++ b/test/test_index.py @@ -385,14 +385,16 @@ class TestIndex(TestBase): try: index.checkout(test_file) except CheckoutError as e: - self.assertEqual(len(e.failed_files), 1) - self.assertEqual(e.failed_files[0], osp.basename(test_file)) - self.assertEqual(len(e.failed_files), len(e.failed_reasons)) - self.assertIsInstance(e.failed_reasons[0], str) - self.assertEqual(len(e.valid_files), 0) - with open(test_file, 'rb') as fd: - s = fd.read() - self.assertTrue(s.endswith(append_data), s) + # detailed exceptions are only possible in older git versions + if rw_repo.git._version_info < (2, 29): + self.assertEqual(len(e.failed_files), 1) + self.assertEqual(e.failed_files[0], osp.basename(test_file)) + self.assertEqual(len(e.failed_files), len(e.failed_reasons)) + self.assertIsInstance(e.failed_reasons[0], str) + self.assertEqual(len(e.valid_files), 0) + with open(test_file, 'rb') as fd: + s = fd.read() + self.assertTrue(s.endswith(append_data), s) else: raise AssertionError("Exception CheckoutError not thrown") |