test: Start using `ddt` library for TCs · gitpython-developers/GitPython@4674163 · GitHub
Skip to content

Commit 4674163

Browse files
committed
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
1 parent 57550cc commit 4674163

4 files changed

Lines changed: 27 additions & 23 deletions

File tree

.appveyor.yml

Lines changed: 9 additions & 9 deletions

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ git:
1616
install:
1717
- git submodule update --init --recursive
1818
- git fetch --tags
19-
- pip install coveralls flake8 sphinx
19+
- pip install coveralls flake8 ddt sphinx
2020

2121
# generate some reflog as git-python tests need it (in master)
2222
- ./init-tests-after-clone.sh

git/test/test_diff.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@
2424
DiffIndex,
2525
NULL_TREE,
2626
)
27+
import ddt
2728

2829

30+
@ddt.ddt
2931
class TestDiff(TestBase):
3032

3133
def tearDown(self):
@@ -118,18 +120,20 @@ def test_diff_of_modified_files_not_added_to_the_index(self):
118120
self.assertEqual(diffs[0].change_type, 'M')
119121
self.assertIsNone(diffs[0].b_blob,)
120122

121-
def test_binary_diff(self):
122-
for method, file_name in ((Diff._index_from_patch_format, 'diff_patch_binary'),
123-
(Diff._index_from_raw_format, 'diff_raw_binary')):
124-
res = method(None, StringProcessAdapter(fixture(file_name)).stdout)
125-
self.assertEqual(len(res), 1)
126-
self.assertEqual(len(list(res.iter_change_type('M'))), 1)
127-
if res[0].diff:
128-
self.assertEqual(res[0].diff,
129-
b"Binary files a/rps and b/rps differ\n",
130-
"in patch mode, we get a diff text")
131-
self.assertIsNotNone(str(res[0]), "This call should just work")
132-
# end for each method to test
123+
@ddt.data(
124+
(Diff._index_from_patch_format, 'diff_patch_binary'),
125+
(Diff._index_from_raw_format, 'diff_raw_binary')
126+
)
127+
def test_binary_diff(self, case):
128+
method, file_name = case
129+
res = method(None, StringProcessAdapter(fixture(file_name)).stdout)
130+
self.assertEqual(len(res), 1)
131+
self.assertEqual(len(list(res.iter_change_type('M'))), 1)
132+
if res[0].diff:
133+
self.assertEqual(res[0].diff,
134+
b"Binary files a/rps and b/rps differ\n",
135+
"in patch mode, we get a diff text")
136+
self.assertIsNotNone(str(res[0]), "This call should just work")
133137

134138
def test_diff_index(self):
135139
output = StringProcessAdapter(fixture('diff_index_patch'))

setup.py

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)