فهرست منبع

Silences an error printed to stderr when running unittests

Ask Solem 13 سال پیش
والد
کامیت
b4b38987b8
3فایلهای تغییر یافته به همراه6 افزوده شده و 6 حذف شده
  1. 0 2
      celery/tests/test_backends/test_redis_unit.py
  2. 6 3
      celery/tests/test_bin/__init__.py
  3. 0 1
      celery/utils/threads.py

+ 0 - 2
celery/tests/test_backends/test_redis_unit.py

@@ -57,8 +57,6 @@ class redis(object):
             pass
 
 
-
-
 class test_RedisBackend(unittest.TestCase):
 
     def get_backend(self):

+ 6 - 3
celery/tests/test_bin/__init__.py

@@ -4,7 +4,7 @@ from __future__ import with_statement
 import os
 
 from celery.bin.base import Command
-from celery.tests.utils import AppCase
+from celery.tests.utils import AppCase, override_stdouts
 
 
 class Object(object):
@@ -55,8 +55,11 @@ class test_Command(AppCase):
     def test_with_bogus_args(self):
         cmd = MockCommand()
         cmd.supports_args = False
-        self.assertRaises(SystemExit,
-                cmd.execute_from_commandline, argv=["--bogus"])
+        with override_stdouts() as (_, stderr):
+            with self.assertRaises(SystemExit):
+                cmd.execute_from_commandline(argv=["--bogus"])
+        self.assertTrue(stderr.getvalue())
+        self.assertIn("Unrecognized", stderr.getvalue())
 
     def test_with_custom_config_module(self):
         prev = os.environ.pop("CELERY_CONFIG_MODULE", None)

+ 0 - 1
celery/utils/threads.py

@@ -63,5 +63,4 @@ class bgThread(Thread):
         self._is_shutdown.set()
         self._is_stopped.wait()
         if self.is_alive():
-            print("JOINING")
             self.join(1e100)