Explorar o código

Fixed the tests ensuring the current __version__ is sane.

Ask Solem %!s(int64=15) %!d(string=hai) anos
pai
achega
64c2a986cc
Modificáronse 3 ficheiros con 17 adicións e 13 borrados
  1. 6 5
      celery/tests/test_celery.py
  2. 10 8
      celery/utils/info.py
  3. 1 0
      contrib/requirements/test.txt

+ 6 - 5
celery/tests/test_celery.py

@@ -1,4 +1,5 @@
-import unittest
+import unittest2 as unittest
+
 import celery
 
 
@@ -6,14 +7,14 @@ class TestInitFile(unittest.TestCase):
 
     def test_version(self):
         self.assertTrue(celery.VERSION)
-        self.assertTrue(len(celery.VERSION) >= 3)
+        self.assertGreater(len(celery.VERSION), 3)
         celery.VERSION = (0, 3, 0)
         self.assertFalse(celery.is_stable_release())
-        self.assertEqual(celery.__version__.count("."), 2)
-        self.assertTrue("(unstable)" in celery.version_with_meta())
+        self.assertGreater(celery.__version__.count("."), 2)
+        self.assertIn("(unstable)", celery.version_with_meta())
         celery.VERSION = (0, 4, 0)
         self.assertTrue(celery.is_stable_release())
-        self.assertTrue("(stable)" in celery.version_with_meta())
+        self.assertIn("(stable)", celery.version_with_meta())
 
     def test_meta(self):
         for m in ("__author__", "__contact__", "__homepage__",

+ 10 - 8
celery/utils/info.py

@@ -39,9 +39,7 @@ def format_routing_table(table=None, indent=0):
                             for name, route in table.items())
     return textindent(routes, indent=indent)
 
-
-def format_broker_info():
-    """Get message broker connection info string for log dumps."""
+def get_broker_info():
     broker_connection = establish_connection()
 
     carrot_backend = broker_connection.backend_cls
@@ -57,8 +55,12 @@ def format_broker_info():
     if not vhost.startswith("/"):
         vhost = "/" + vhost
 
-    return BROKER_FORMAT % {"carrot_backend": carrot_backend,
-                            "userid": broker_connection.userid,
-                            "host": broker_connection.hostname,
-                            "port": port,
-                            "vhost": vhost}
+    return {"carrot_backend": carrot_backend,
+            "userid": broker_connection.userid,
+            "host": broker_connection.hostname,
+            "port": port,
+            "vhost": vhost}
+
+def format_broker_info(info=None):
+    """Get message broker connection info string for log dumps."""
+    return BROKER_FORMAT % get_broker_info()

+ 1 - 0
contrib/requirements/test.txt

@@ -1,3 +1,4 @@
+unittest2
 simplejson
 nose
 nose-cover3