Permalink
Browse files

Bug 735117 - Raise SkipTest when memcached is not usable; r=telliott

  • Loading branch information...
1 parent 7c5acb3 commit 6c2c8de34c1616a19c13dbb90fdc65e7d5ec317c @rfk rfk committed Mar 16, 2012
Showing with 11 additions and 9 deletions.
  1. +2 −1 dev-reqs.txt
  2. +1 −1 setup.py
  3. +8 −7 syncstorage/tests/test_memcachedsql.py
View
@@ -21,6 +21,7 @@ PyMySQL
repoze.who
repoze.who.plugins.macauth
macauthlib
-git+git://github.com/mozilla-services/tokenlib.git
+tokenlib
+unittest2
git+git://github.com/mozilla-services/mozservices.git
git+git://github.com/mozilla-services/cornice.git
View
@@ -6,7 +6,7 @@
import re
-install_requires = ['SQLALchemy<=0.6.99', 'PasteDeploy', 'WebOb',
+install_requires = ['SQLALchemy<=0.6.99', 'PasteDeploy', 'WebOb', 'unittest2',
'Routes', 'simplejson', 'cef', 'mozsvc', 'cornice',
'repoze.who', 'repoze.who.plugins.macauth', 'macauthlib']
@@ -1,7 +1,7 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
-import unittest
+import unittest2
import time
from tempfile import mkstemp
import os
@@ -20,12 +20,13 @@
_UID = 1
_PLD = '*' * 500
-# manual registration
-if MEMCACHED:
- class TestMemcachedSQLStorage(unittest.TestCase):
+class TestMemcachedSQLStorage(unittest2.TestCase):
def setUp(self):
+ if not MEMCACHED:
+ raise unittest2.SkipTest
+
fd, self.dbfile = mkstemp()
os.close(fd)
@@ -269,10 +270,10 @@ def test_flush_all(self):
def test_suite():
- suite = unittest.TestSuite()
+ suite = unittest2.TestSuite()
if MEMCACHED:
- suite.addTest(unittest.makeSuite(TestMemcachedSQLStorage))
+ suite.addTest(unittest2.makeSuite(TestMemcachedSQLStorage))
return suite
if __name__ == "__main__":
- unittest.main(defaultTest="test_suite")
+ unittest2.main(defaultTest="test_suite")

0 comments on commit 6c2c8de

Please sign in to comment.