~launchpad-pqm/launchpad/devel

10713.1.1 by Gary Poster
use new version of z3c.recipe.filetemplate and zc.buildout fork to use relative paths.
1
#!${buildout:executable} -S
10245.2.6 by Bjorn Tillenius
Add script to kill the test services.
2
#
3
# Copyright 2009 Canonical Ltd.  This software is licensed under the
4
# GNU Affero General Public License version 3 (see the file LICENSE).
5
"""Kill all the test services that may persist between test runs."""
6
10713.1.1 by Gary Poster
use new version of z3c.recipe.filetemplate and zc.buildout fork to use relative paths.
7
# Initialize our paths.
8
${python-relative-path-setup}
9
import sys
10
sys.path.insert(0, ${scripts:parts-directory|path-repr})
11
import site
10245.2.6 by Bjorn Tillenius
Add script to kill the test services.
12
13
# Tell canonical.config to use the testrunner config instance, so that
14
# we don't kill the real services.
15
from canonical.config import config
16
config.setInstance('testrunner')
17
config.generate_overrides()
18
19
import sys
20
21
from canonical.testing.layers import MemcachedLayer
11750.1.1 by Paul Hummer
Fixed kill-test-services buggery
22
from canonical.librarian.testing.server import LibrarianTestSetup
10245.2.6 by Bjorn Tillenius
Add script to kill the test services.
23
from lp.services.osutils import kill_by_pidfile
24
25
26
def main(args):
27
    if '-h' in args or '--help' in args:
28
        print __doc__
29
        return 0
30
    print "Killing Memcached....",
31
    kill_by_pidfile(MemcachedLayer.getPidFile())
32
    print "done."
33
    print "Killing Librarian....",
34
    LibrarianTestSetup().tearDownRoot()
35
    print "done."
36
    return 0
37
38
39
if __name__ == '__main__':
40
    sys.exit(main(sys.argv[1:]))