← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/quieter-test-output into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/quieter-test-output into lp:launchpad.

Commit message:
Reduce output noise from celery-related and codeimport tests.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/quieter-test-output/+merge/307721

Reduce output noise from celery-related and codeimport tests.  Some of these corrupted subunit streams on occasion, causing spurious buildbot failures.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/quieter-test-output into lp:launchpad.
=== modified file 'lib/lp/codehosting/codeimport/tests/test_worker.py'
--- lib/lp/codehosting/codeimport/tests/test_worker.py	2016-09-30 13:27:27 +0000
+++ lib/lp/codehosting/codeimport/tests/test_worker.py	2016-10-05 14:11:35 +0000
@@ -44,6 +44,7 @@
     tree as CVSTree,
     )
 from dulwich.repo import Repo as GitRepo
+from fixtures import FakeLogger
 import subvertpy
 import subvertpy.client
 import subvertpy.ra
@@ -935,6 +936,7 @@
 
     def setUp(self):
         super(TestCVSImport, self).setUp()
+        self.useFixture(FakeLogger())
         self.setUpImport()
 
     def makeForeignCommit(self, source_details):

=== modified file 'lib/lp/services/job/tests/__init__.py'
--- lib/lp/services/job/tests/__init__.py	2015-10-12 13:16:54 +0000
+++ lib/lp/services/job/tests/__init__.py	2016-10-05 14:11:35 +0000
@@ -1,4 +1,4 @@
-# Copyright 2012-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2012-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -12,6 +12,7 @@
 
 
 from contextlib import contextmanager
+import subprocess
 
 from testtools.content import text_content
 
@@ -19,6 +20,7 @@
 from lp.testing.fixture import CaptureOops
 
 
+@contextmanager
 def celery_worker(queue, cwd=None):
     """Return a ContextManager for a "celery worker" instance.
 
@@ -26,7 +28,6 @@
     currently-configured BROKER_URL, and able to run CeleryRunJob tasks.
     """
     from lp.services.job.celeryjob import CeleryRunJob
-    from lazr.jobrunner.tests.test_celerytask import running
     # convert config params to a URL, so they can be passed as --broker.
     with CeleryRunJob.app.broker_connection() as connection:
         broker_uri = connection.as_uri(include_password=True)
@@ -39,7 +40,15 @@
         '--queues', queue,
         '--include', 'lp.services.job.tests.celery_helpers',
     )
-    return running('bin/celery', cmd_args, cwd=cwd)
+    with open('/dev/null', 'w') as devnull:
+        proc = subprocess.Popen(
+            ('bin/celery',) + cmd_args, stdout=devnull,
+            stderr=subprocess.PIPE, cwd=cwd)
+        try:
+            yield proc
+        finally:
+            proc.terminate()
+            proc.wait()
 
 
 @contextmanager


Follow ups