31
32
def assertFinishedCleanly(self, result):
32
33
"""Assert that a server process finished cleanly."""
33
self.assertEqual((0, '', ''), tuple(result))
34
# XXX gary 2009-10-15 bug 316192
35
# Ideally, this method would only be this single line:
37
# self.assertEqual((0, '', ''), tuple(result))
39
# However, because of the bug above, stderr (the last value) can
40
# include complaints that bzr tried to import certain plugins but
41
# was unable to. This can make the last value into something like
42
# this (concatenate the strings):
44
# "No module named dbus.bus\n"
45
# "Unable to load plugin 'dbus' from "
46
# "'/usr/lib/python2.4/site-packages/bzrlib/plugins'\n"
47
# "No module named dbus.bus\n"
48
# "Unable to load plugin 'avahi' from "
49
# "'/usr/lib/python2.4/site-packages/bzrlib/plugins'\n"
51
# Therefore, for now, we allow stderr to have messages like
52
# that, with a regex. A fix for the bzr bug mentioned above has
53
# already been released, so hopefully soon this method can
54
# return to the single assert above, this module will no longer
55
# have to import re, and this comment can be consigned to
57
self.assertEqual(0, result[0]) # the return code
58
self.assertEqual('', result[1]) # stdout
59
self.failUnless(re.match(
60
r"(No module named \S+\n|"
61
"Unable to load plugin \S+ from '/usr/lib/python[^']+'\n)*$",
35
64
def get_python_path(self):
36
65
"""Return the path to the Python interpreter."""