[med-svn] [python-fitbit] 04/05: fix unit testing with nose

Olivier Sallou osallou at debian.org
Sat Aug 22 14:07:34 UTC 2015


This is an automated email from the git hooks/post-receive script.

osallou pushed a commit to branch master
in repository python-fitbit.

commit 46b8115d1e268596325da15e854018cff6e4c4e0
Author: Olivier Sallou <osallou at debian.org>
Date:   Sat Aug 22 14:04:19 2015 +0000

    fix unit testing with nose
---
 debian/patches/0002-fix_tests_for_nose.patch | 52 ++++++++++++++++++++++++++++
 debian/patches/disable_auth_test.patch       | 14 +++++---
 debian/patches/series                        |  1 +
 3 files changed, 63 insertions(+), 4 deletions(-)

diff --git a/debian/patches/0002-fix_tests_for_nose.patch b/debian/patches/0002-fix_tests_for_nose.patch
new file mode 100644
index 0000000..c83d5eb
--- /dev/null
+++ b/debian/patches/0002-fix_tests_for_nose.patch
@@ -0,0 +1,52 @@
+From: Olivier Sallou <osallou at debian.org>
+Date: Sat, 22 Aug 2015 14:02:40 +0000
+Subject: fix_tests_for_nose
+
+To make tests ok with nose, we need to adapt a little the way to execute tests.
+mock version may also have an impact and I needed to manage method call with no parameter.
+---
+ fitbit_tests/__init__.py | 21 ---------------------
+ fitbit_tests/test_api.py |  4 +++-
+ 2 files changed, 3 insertions(+), 22 deletions(-)
+
+diff --git a/fitbit_tests/__init__.py b/fitbit_tests/__init__.py
+index a507c66..e69de29 100644
+--- a/fitbit_tests/__init__.py
++++ b/fitbit_tests/__init__.py
+@@ -1,21 +0,0 @@
+-import unittest
+-from .test_exceptions import ExceptionTest
+-from .test_auth import AuthTest
+-from .test_api import APITest, CollectionResourceTest, DeleteCollectionResourceTest, MiscTest
+-
+-
+-def all_tests(consumer_key="", consumer_secret="", user_key=None, user_secret=None):
+-    kwargs = {
+-        "consumer_key": consumer_key,
+-        "consumer_secret": consumer_secret,
+-        "user_key": user_key,
+-        "user_secret": user_secret,
+-    }
+-    suite = unittest.TestSuite()
+-    suite.addTest(unittest.makeSuite(ExceptionTest))
+-    #suite.addTest(unittest.makeSuite(AuthTest))
+-    suite.addTest(unittest.makeSuite(APITest))
+-    suite.addTest(unittest.makeSuite(CollectionResourceTest))
+-    suite.addTest(unittest.makeSuite(DeleteCollectionResourceTest))
+-    suite.addTest(unittest.makeSuite(MiscTest))
+-    return suite
+diff --git a/fitbit_tests/test_api.py b/fitbit_tests/test_api.py
+index bef4aa0..3ec4d51 100644
+--- a/fitbit_tests/test_api.py
++++ b/fitbit_tests/test_api.py
+@@ -11,7 +11,9 @@ class TestBase(TestCase):
+     def setUp(self):
+         self.fb = Fitbit('x', 'y')
+ 
+-    def common_api_test(self, funcname, args, kwargs, expected_args, expected_kwargs):
++    def common_api_test(self, funcname=None, args=None, kwargs=None, expected_args=None, expected_kwargs=None):
++        if funcname is None:
++            return
+         # Create a fitbit object, call the named function on it with the given
+         # arguments and verify that make_request is called with the expected args and kwargs
+         with mock.patch.object(self.fb, 'make_request') as make_request:
diff --git a/debian/patches/disable_auth_test.patch b/debian/patches/disable_auth_test.patch
index df2ee2a..0deb4da 100644
--- a/debian/patches/disable_auth_test.patch
+++ b/debian/patches/disable_auth_test.patch
@@ -1,10 +1,16 @@
-Author: Iain R. Learmonth <irl at fsfe.org>
-Last-Update: Mon, 03 Feb 2014 21:38:29 +0100
-Description: Disable the Auth test suite as no credentials available
+From: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
+Date: Sat, 22 Aug 2015 12:52:19 +0000
+Subject: disable_auth_test
 
+---
+ fitbit_tests/__init__.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fitbit_tests/__init__.py b/fitbit_tests/__init__.py
+index e3e0700..a507c66 100644
 --- a/fitbit_tests/__init__.py
 +++ b/fitbit_tests/__init__.py
-@@ -13,7 +13,7 @@
+@@ -13,7 +13,7 @@ def all_tests(consumer_key="", consumer_secret="", user_key=None, user_secret=No
      }
      suite = unittest.TestSuite()
      suite.addTest(unittest.makeSuite(ExceptionTest))
diff --git a/debian/patches/series b/debian/patches/series
index 15f8b80..9a10fd5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 disable_auth_test.patch
+0002-fix_tests_for_nose.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-fitbit.git



More information about the debian-med-commit mailing list