on xenial help sign in
Add an error message on failed initctl status unity8.
commit2f1ab95b32f5617401ee344093379199c04dd0b5 authorMichał Sawicz <michal.sawicz@canonical.com> dateMon 14 Oct 2013, 10:54 (13 years ago) parent8a28b59
1 file changed+19−9
tests/autopilot/unity8/shell/tests/__init__.py+19−9
tests/autopilot/unity8/shell/tests/__init__.py+19−9
@@ -84,20 +84,30 @@ class UnityTestCase(AutopilotTestCase):
8484
8585 @classmethod
8686 def setUpClass(cls):
87− output = subprocess.check_output([
88− "/sbin/initctl",
89− "status",
90− "unity8"
91− ])
87+ try:
88+ output = subprocess.check_output([
89+ "/sbin/initctl",
90+ "status",
91+ "unity8"
92+ ],
93+ stderr=subprocess.STDOUT)
94+ except subprocess.CalledProcessError, e:
95+ sys.stderr.write(
96+ "Error: `initctl status unity8` failed, most probably the unity8 session could not be found:\n\n"
97+ "{0}\n"
98+ "Please install unity8 or copy data/unity8.conf to {1}\n".format(
99+ e.output,
100+ os.path.join(os.getenv("XDG_CONFIG_HOME", os.path.join(os.getenv("HOME"), ".config")), "upstart")
101+ ))
102+ sys.exit(1)
92103
93104 if "start/" in output:
94105 sys.stderr.write(
95− "Error: Unity is currently running, these tests require it to "
96− "be 'stopped'.\n"
106+ "Error: Unity is currently running, these tests require it to be 'stopped'.\n"
97107 "Please run this command before running these tests: \n"
98− "initctl stop unity\n"
108+ "initctl stop unity8\n"
99109 )
100− sys.exit(1)
110+ sys.exit(2)
101111
102112 def setUp(self):
103113 super(UnityTestCase, self).setUp()