on xenial help sign in
Suppress more stderr, move logging a bit.
6c67fd9Michał Sawicz
tests/autopilot/unity8/shell/tests/__init__.py+9−11
@@ -89,8 +89,7 @@ class UnityTestCase(AutopilotTestCase):
89 "/sbin/initctl",
89 "/sbin/initctl",
90 "status",
90 "status",
91 "unity8"
91 "unity8"
92− ],
93− stderr=subprocess.STDOUT)
92+ ], stderr=subprocess.STDOUT)
94 except subprocess.CalledProcessError, e:
93 except subprocess.CalledProcessError, e:
95 sys.stderr.write(
94 sys.stderr.write(
96 "Error: `initctl status unity8` failed, most probably the unity8 session could not be found:\n\n"
95 "Error: `initctl status unity8` failed, most probably the unity8 session could not be found:\n\n"
@@ -197,8 +196,7 @@ class UnityTestCase(AutopilotTestCase):
197 "get-env",
196 "get-env",
198 "--global",
197 "--global",
199 key
198 key
200− ],
201− stderr=subprocess.STDOUT).rstrip()
199+ ], stderr=subprocess.STDOUT).rstrip()
202 except subprocess.CalledProcessError:
200 except subprocess.CalledProcessError:
203 current_value = None
201 current_value = None
204
202
@@ -207,20 +205,20 @@ class UnityTestCase(AutopilotTestCase):
207 "set-env",
205 "set-env",
208 "--global",
206 "--global",
209 "%s=%s" % (key, value)
207 "%s=%s" % (key, value)
210− ])
208+ ], stderr=subprocess.STDOUT)
211 self.addCleanup(self._upstart_reset_env, key, current_value)
209 self.addCleanup(self._upstart_reset_env, key, current_value)
212
210
213 def _upstart_reset_env(self, key, value):
211 def _upstart_reset_env(self, key, value):
214 logger.info("Resetting upstart env %s to %s", key, value)
212 logger.info("Resetting upstart env %s to %s", key, value)
215 if value is None:
213 if value is None:
216− subprocess.call(["/sbin/initctl", "unset-env", key])
214+ subprocess.call(["/sbin/initctl", "unset-env", key], stderr=subprocess.STDOUT)
217 else:
215 else:
218 subprocess.call([
216 subprocess.call([
219 "/sbin/initctl",
217 "/sbin/initctl",
220 "set-env",
218 "set-env",
221 "--global",
219 "--global",
222 "%s=%s" % (key, value)
220 "%s=%s" % (key, value)
223− ])
221+ ], stderr=subprocess.STDOUT)
224
222
225 def launch_unity(self, **kwargs):
223 def launch_unity(self, **kwargs):
226 """Launch the unity shell, return a proxy object for it."""
224 """Launch the unity shell, return a proxy object for it."""
@@ -276,7 +274,7 @@ class UnityTestCase(AutopilotTestCase):
276 "unity8",
274 "unity8",
277 binary_arg,
275 binary_arg,
278 extra_args,
276 extra_args,
279− ])
277+ ], stderr=subprocess.STDOUT)
280
278
281 self.addCleanup(self._cleanup_launching_upstart_unity)
279 self.addCleanup(self._cleanup_launching_upstart_unity)
282
280
@@ -292,20 +290,20 @@ class UnityTestCase(AutopilotTestCase):
292
290
293 # FIXME: Workaround for issue: lp:1239491
291 # FIXME: Workaround for issue: lp:1239491
294 if model() != "Desktop":
292 if model() != "Desktop":
293+ logger.info("Stopping maliit-server before unity.")
295 try:
294 try:
296− logger.info("Stopping maliit-server before unity.")
297 subprocess.check_call([
295 subprocess.check_call([
298 "/sbin/initctl",
296 "/sbin/initctl",
299 "stop",
297 "stop",
300 "maliit-server"
298 "maliit-server"
301− ])
299+ ], stderr=subprocess.STDOUT)
302 except subprocess.CalledProcessError:
300 except subprocess.CalledProcessError:
303 logger.warning(
301 logger.warning(
304 "Appears that maliit-server was already stopped!"
302 "Appears that maliit-server was already stopped!"
305 )
303 )
306
304
305+ logger.info("Stopping unity")
307 try:
306 try:
308− logger.info("Stopping unity")
309 subprocess.check_call(["/sbin/initctl", "stop", "unity8"], stderr=subprocess.STDOUT)
307 subprocess.check_call(["/sbin/initctl", "stop", "unity8"], stderr=subprocess.STDOUT)
310 except subprocess.CalledProcessError:
308 except subprocess.CalledProcessError:
311 logger.warning("Appears unity was already stopped!")
309 logger.warning("Appears unity was already stopped!")