diff options
author | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-09-27 23:57:53 +0200 |
---|---|---|
committer | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-09-28 03:35:38 +0200 |
commit | 467416356a96148bcb01feb771f6ea20e5215727 (patch) | |
tree | b76b72a024eb285524fc8e846a7ab22aeb243ee4 /git/test/test_diff.py | |
parent | 57550cce417340abcc25b20b83706788328f79bd (diff) | |
download | gitpython-467416356a96148bcb01feb771f6ea20e5215727.tar.gz |
test: Start using `ddt` library for TCs
+ DataDriven TCs for identifying which separate case failed.
+ appveyor: rework matrix, conda3.4 cannot install in develop mode
Diffstat (limited to 'git/test/test_diff.py')
-rw-r--r-- | git/test/test_diff.py | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/git/test/test_diff.py b/git/test/test_diff.py index 57c6bc79..a8960297 100644 --- a/git/test/test_diff.py +++ b/git/test/test_diff.py @@ -24,8 +24,10 @@ from git import ( DiffIndex, NULL_TREE, ) +import ddt +@ddt.ddt class TestDiff(TestBase): def tearDown(self): @@ -118,18 +120,20 @@ class TestDiff(TestBase): self.assertEqual(diffs[0].change_type, 'M') self.assertIsNone(diffs[0].b_blob,) - def test_binary_diff(self): - for method, file_name in ((Diff._index_from_patch_format, 'diff_patch_binary'), - (Diff._index_from_raw_format, 'diff_raw_binary')): - res = method(None, StringProcessAdapter(fixture(file_name)).stdout) - self.assertEqual(len(res), 1) - self.assertEqual(len(list(res.iter_change_type('M'))), 1) - if res[0].diff: - self.assertEqual(res[0].diff, - b"Binary files a/rps and b/rps differ\n", - "in patch mode, we get a diff text") - self.assertIsNotNone(str(res[0]), "This call should just work") - # end for each method to test + @ddt.data( + (Diff._index_from_patch_format, 'diff_patch_binary'), + (Diff._index_from_raw_format, 'diff_raw_binary') + ) + def test_binary_diff(self, case): + method, file_name = case + res = method(None, StringProcessAdapter(fixture(file_name)).stdout) + self.assertEqual(len(res), 1) + self.assertEqual(len(list(res.iter_change_type('M'))), 1) + if res[0].diff: + self.assertEqual(res[0].diff, + b"Binary files a/rps and b/rps differ\n", + "in patch mode, we get a diff text") + self.assertIsNotNone(str(res[0]), "This call should just work") def test_diff_index(self): output = StringProcessAdapter(fixture('diff_index_patch')) |