← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-ServersToStart into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-ServersToStart into launchpad:master.

Commit message:
Fix ServersToStart for Python 3

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398015

The elements of SERVICES aren't orderable on Python 3, so upgrade this to lp.testing.TestCase and use assertContentEqual instead of trying to sort them manually.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-ServersToStart into launchpad:master.
diff --git a/lib/lp/scripts/tests/test_runlaunchpad.py b/lib/lp/scripts/tests/test_runlaunchpad.py
index c310cde..27d2051 100644
--- a/lib/lp/scripts/tests/test_runlaunchpad.py
+++ b/lib/lp/scripts/tests/test_runlaunchpad.py
@@ -17,8 +17,6 @@ import shutil
 import tempfile
 from textwrap import dedent
 
-import testtools
-
 from lp.scripts.runlaunchpad import (
     get_services_to_run,
     gunicornify_zope_config_file,
@@ -30,10 +28,10 @@ from lp.scripts.runlaunchpad import (
 from lp.services.compat import mock
 import lp.services.config
 from lp.services.config import config
-import lp.testing
+from lp.testing import TestCase
 
 
-class CommandLineArgumentProcessing(lp.testing.TestCase):
+class CommandLineArgumentProcessing(TestCase):
     """runlaunchpad.py's command line arguments fall into two parts. The first
     part specifies which services to run, then second part is passed directly
     on to the Zope webserver start up.
@@ -77,7 +75,7 @@ class CommandLineArgumentProcessing(lp.testing.TestCase):
             split_out_runlaunchpad_arguments(['-o', 'foo', '--bar=baz']))
 
 
-class TestDefaultConfigArgument(lp.testing.TestCase):
+class TestDefaultConfigArgument(TestCase):
     """Tests for the processing of the -C argument."""
 
     def setUp(self):
@@ -126,12 +124,12 @@ class TestDefaultConfigArgument(lp.testing.TestCase):
         self.assertEqual('test', config.instance_name)
 
 
-class ServersToStart(testtools.TestCase):
+class ServersToStart(TestCase):
     """Test server startup control."""
 
     def setUp(self):
         """Make sure that only the Librarian is configured to launch."""
-        testtools.TestCase.setUp(self)
+        super(ServersToStart, self).setUp()
         launch_data = """
             [librarian_server]
             launch: True
@@ -146,7 +144,7 @@ class ServersToStart(testtools.TestCase):
     def test_nothing_explicitly_requested(self):
         """Implicitly start services based on the config.*.launch property.
         """
-        services = sorted(get_services_to_run([]))
+        services = get_services_to_run([])
         expected = [SERVICES['librarian']]
 
         # The search test services may or may not be asked to run.
@@ -157,8 +155,7 @@ class ServersToStart(testtools.TestCase):
         if config.rabbitmq.launch:
             expected.append(SERVICES['rabbitmq'])
 
-        expected = sorted(expected)
-        self.assertEqual(expected, services)
+        self.assertContentEqual(expected, services)
 
     def test_explicit_request_overrides(self):
         """Only start those services which are explicitly requested,