Merge lp:~wgrant/launchpad/buildd-virtualenv into lp:launchpad

Proposed by William Grant
Status: Merged
Merged at revision: 18650
Proposed branch: lp:~wgrant/launchpad/buildd-virtualenv
Merge into: lp:launchpad
Diff against target: 50 lines (+13/-2)
1 file modified
lib/lp/buildmaster/tests/mock_slaves.py (+13/-2)
To merge this branch: bzr merge lp:~wgrant/launchpad/buildd-virtualenv
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+345501@code.launchpad.net

Commit message

Fix the test suite to run buildd-slave.tac in its virtualenv.

Description of the change

Broke when launchpad-developer-dependencies stopped pulling in python-twisted-core via python-lpbuildd.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/buildmaster/tests/mock_slaves.py'
2--- lib/lp/buildmaster/tests/mock_slaves.py 2018-01-26 13:47:51 +0000
3+++ lib/lp/buildmaster/tests/mock_slaves.py 2018-05-14 09:02:33 +0000
4@@ -20,6 +20,7 @@
5 ]
6
7 import os
8+import sys
9 import types
10 import xmlrpclib
11
12@@ -37,6 +38,7 @@
13 from lp.buildmaster.interactor import BuilderSlave
14 from lp.buildmaster.interfaces.builder import CannotFetchFile
15 from lp.services.config import config
16+from lp.services.daemons.tachandler import twistd_script
17 from lp.services.webapp import urlappend
18 from lp.testing.sampledata import I386_ARCHITECTURE_NAME
19
20@@ -274,19 +276,28 @@
21 return defer.Deferred()
22
23
24+class LPBuilddSlaveTestSetup(BuilddSlaveTestSetup):
25+ """A BuilddSlaveTestSetup that uses the LP virtualenv."""
26+
27+ def setUp(self):
28+ super(LPBuilddSlaveTestSetup, self).setUp(
29+ python_path=sys.executable,
30+ twistd_script=twistd_script)
31+
32+
33 class SlaveTestHelpers(fixtures.Fixture):
34
35 @property
36 def base_url(self):
37 """The URL for the XML-RPC service set up by `BuilddSlaveTestSetup`."""
38- return 'http://localhost:%d' % BuilddSlaveTestSetup().daemon_port
39+ return 'http://localhost:%d' % LPBuilddSlaveTestSetup().daemon_port
40
41 def getServerSlave(self):
42 """Set up a test build slave server.
43
44 :return: A `BuilddSlaveTestSetup` object.
45 """
46- tachandler = self.useFixture(BuilddSlaveTestSetup())
47+ tachandler = self.useFixture(LPBuilddSlaveTestSetup())
48 self.addDetail(
49 'xmlrpc-log-file',
50 Content(