1
# Copyright 2009 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
"""Windmill test integration wrapper for Launchpad.
6
This wrapper starts a test Launchpad instance that can be
9
If the --server-only option is given, only the Launchpad server
10
is started. This allows one to invoke the windmill script multiple
18
import windmill.bin.windmill_bin
20
from canonical.config import config
21
from canonical.testing.layers import (
25
LayerProcessController,
31
"""Set-up the Launchpad app-server against which windmill tests are run.
33
config.setInstance('testrunner-appserver')
34
# Hard-code the app-server configuration, since that's what can
36
sys.stderr.write('Starting up Launchpad... ')
39
# The below tests installs atexit handler that will clean-up their
40
# resources on. So we install only one for the Database.
41
atexit.register(DatabaseLayer.tearDown)
42
LibrarianLayer.setUp()
43
GoogleServiceLayer.setUp()
44
LayerProcessController._setConfig()
45
LayerProcessController.startSMTPServer()
46
LayerProcessController.startAppServer()
47
sys.stderr.write('done.\n')
51
"""Start windmill using our command line arguments.
53
This function exits once windmill has terminated.
55
# The windmill main function will interpret the command-line arguments
57
windmill.bin.windmill_bin.main()
60
def waitForInterrupt():
61
"""Sits in a sleep loop waiting for a Ctrl-C."""
63
sys.stderr.write('Waiting for Ctrl-C...\n')
66
except KeyboardInterrupt:
72
if sys.argv[1] == '--server-only':
76
sys.stderr.write('Shutting down Launchpad...\n')