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

File tree

4 files changed

+27
-23
lines changed

4 files changed

+27
-23
lines changed

Diff for: .appveyor.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@ environment:
88
- PYTHON: "C:\\Python27"
99
PYTHON_VERSION: "2.7"
1010
GIT_PATH: "%GIT_DAEMON_PATH%"
11-
- PYTHON: "C:\\Miniconda"
11+
- PYTHON: "C:\\Miniconda-x64"
1212
PYTHON_VERSION: "2.7"
1313
IS_CONDA: "yes"
1414
GIT_PATH: "%CYGWIN_GIT_PATH%"
1515

1616
- PYTHON: "C:\\Python34-x64"
1717
PYTHON_VERSION: "3.4"
18-
GIT_PATH: "%CYGWIN64_GIT_PATH%"
18+
GIT_PATH: "%GIT_DAEMON_PATH%"
1919
- PYTHON: "C:\\Python34-x64"
2020
PYTHON_VERSION: "3.4"
2121
GIT_PATH: "%CYGWIN_GIT_PATH%"
22-
- PYTHON: "C:\\Miniconda3-x64"
23-
PYTHON_VERSION: "3.4"
24-
IS_CONDA: "yes"
25-
GIT_PATH: "%GIT_DAEMON_PATH%"
2622

2723
- PYTHON: "C:\\Python35-x64"
2824
PYTHON_VERSION: "3.5"
2925
GIT_PATH: "%GIT_DAEMON_PATH%"
3026
- PYTHON: "C:\\Python35-x64"
3127
PYTHON_VERSION: "3.5"
3228
GIT_PATH: "%CYGWIN64_GIT_PATH%"
29+
- PYTHON: "C:\\Miniconda35-x64"
30+
PYTHON_VERSION: "3.5"
31+
IS_CONDA: "yes"
32+
GIT_PATH: "%GIT_DAEMON_PATH%"
3333

3434
install:
3535
- set PATH=%PYTHON%;%PYTHON%\Scripts;%GIT_PATH%;%PATH%
@@ -44,9 +44,9 @@ install:
4444
4545
- IF "%IS_CONDA%"=="yes" (
4646
conda info -a &
47-
conda install --yes --quiet pip smmap
47+
conda install --yes --quiet pip
4848
)
49-
- pip install nose wheel coveralls
49+
- pip install nose ddt wheel coveralls
5050
- IF "%PYTHON_VERSION%"=="2.7" (
5151
pip install mock
5252
)
@@ -68,7 +68,7 @@ install:
6868
git config --global user.email "[email protected]"
6969
git config --global user.name "Travis Runner"
7070
71-
- python setup.py develop
71+
- pip install -e .
7272

7373
build: false
7474

Diff for: .travis.yml

+1-1
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

Diff for: git/test/test_diff.py

+16-12
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'))

Diff for: setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def _stamp_version(filename):
6868
print("WARNING: Couldn't find version line in file %s" % filename, file=sys.stderr)
6969

7070
install_requires = ['gitdb >= 0.6.4']
71-
test_requires = ['node']
71+
test_requires = ['node', 'ddt']
7272
if sys.version_info[:2] < (2, 7):
7373
install_requires.append('ordereddict')
7474
test_requires.append('mock')

0 commit comments

Comments
 (0)