summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKostis Anagnostopoulos <ankostis@gmail.com>2016-09-27 23:57:53 +0200
committerKostis Anagnostopoulos <ankostis@gmail.com>2016-09-28 03:35:38 +0200
commit467416356a96148bcb01feb771f6ea20e5215727 (patch)
treeb76b72a024eb285524fc8e846a7ab22aeb243ee4
parent57550cce417340abcc25b20b83706788328f79bd (diff)
downloadgitpython-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
-rw-r--r--.appveyor.yml18
-rw-r--r--.travis.yml2
-rw-r--r--git/test/test_diff.py28
-rwxr-xr-xsetup.py2
4 files changed, 27 insertions, 23 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index 6f7d3d4a..8ca22ea9 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -8,21 +8,17 @@ environment:
- PYTHON: "C:\\Python27"
PYTHON_VERSION: "2.7"
GIT_PATH: "%GIT_DAEMON_PATH%"
- - PYTHON: "C:\\Miniconda"
+ - PYTHON: "C:\\Miniconda-x64"
PYTHON_VERSION: "2.7"
IS_CONDA: "yes"
GIT_PATH: "%CYGWIN_GIT_PATH%"
- PYTHON: "C:\\Python34-x64"
PYTHON_VERSION: "3.4"
- GIT_PATH: "%CYGWIN64_GIT_PATH%"
+ GIT_PATH: "%GIT_DAEMON_PATH%"
- PYTHON: "C:\\Python34-x64"
PYTHON_VERSION: "3.4"
GIT_PATH: "%CYGWIN_GIT_PATH%"
- - PYTHON: "C:\\Miniconda3-x64"
- PYTHON_VERSION: "3.4"
- IS_CONDA: "yes"
- GIT_PATH: "%GIT_DAEMON_PATH%"
- PYTHON: "C:\\Python35-x64"
PYTHON_VERSION: "3.5"
@@ -30,6 +26,10 @@ environment:
- PYTHON: "C:\\Python35-x64"
PYTHON_VERSION: "3.5"
GIT_PATH: "%CYGWIN64_GIT_PATH%"
+ - PYTHON: "C:\\Miniconda35-x64"
+ PYTHON_VERSION: "3.5"
+ IS_CONDA: "yes"
+ GIT_PATH: "%GIT_DAEMON_PATH%"
install:
- set PATH=%PYTHON%;%PYTHON%\Scripts;%GIT_PATH%;%PATH%
@@ -44,9 +44,9 @@ install:
- IF "%IS_CONDA%"=="yes" (
conda info -a &
- conda install --yes --quiet pip smmap
+ conda install --yes --quiet pip
)
- - pip install nose wheel coveralls
+ - pip install nose ddt wheel coveralls
- IF "%PYTHON_VERSION%"=="2.7" (
pip install mock
)
@@ -68,7 +68,7 @@ install:
git config --global user.email "travis@ci.com"
git config --global user.name "Travis Runner"
- - python setup.py develop
+ - pip install -e .
build: false
diff --git a/.travis.yml b/.travis.yml
index 6bbb6dfd..5c98c4d2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,7 +16,7 @@ git:
install:
- git submodule update --init --recursive
- git fetch --tags
- - pip install coveralls flake8 sphinx
+ - pip install coveralls flake8 ddt sphinx
# generate some reflog as git-python tests need it (in master)
- ./init-tests-after-clone.sh
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'))
diff --git a/setup.py b/setup.py
index b3b43eb3..2e8ee520 100755
--- a/setup.py
+++ b/setup.py
@@ -68,7 +68,7 @@ def _stamp_version(filename):
print("WARNING: Couldn't find version line in file %s" % filename, file=sys.stderr)
install_requires = ['gitdb >= 0.6.4']
-test_requires = ['node']
+test_requires = ['node', 'ddt']
if sys.version_info[:2] < (2, 7):
install_requires.append('ordereddict')
test_requires.append('mock')