on xenial help sign in
Make sure that unity is running and the dash is not.
5ee1d2fLeo Arias
tests/autopilot/unity8/process_helpers.py+10
@@ -223,6 +223,16 @@ def stop_job(name):
223 raise
223 raise
224
224
225
225
226+def is_job_running(name):
227+ """Return True if the job is running. Otherwise, False.
228+
229+ :param str name: The name of the job.
230+ :raises JobError: if it's not possible to get the status of the job.
231+
232+ """
233+ return 'start/running' in get_job_status(name)
234+
235+
226def _get_unity_status():
236def _get_unity_status():
227 try:
237 try:
228 return get_job_status('unity8')
238 return get_job_status('unity8')
tests/autopilot/unity8/shell/tests/__init__.py+12−3
@@ -35,7 +35,10 @@ import os.path
35import subprocess
35import subprocess
36import sys
36import sys
37from testtools.matchers import Equals
37from testtools.matchers import Equals
38+from ubuntuuitoolkit import (
38−from ubuntuuitoolkit import fixture_setup as toolkit_fixtures
39+ fixture_setup as toolkit_fixtures,
40+ ubuntu_scenarios
41+)
39
42
40from unity8 import (
43from unity8 import (
41 get_lib_path,
44 get_lib_path,
@@ -405,13 +408,15 @@ class UnityTestCase(AutopilotTestCase):
405
408
406class DashBaseTestCase(AutopilotTestCase):
409class DashBaseTestCase(AutopilotTestCase):
407
410
408− scenarios = _get_device_emulation_scenarios()
411+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
409 qml_mock_enabled = True
412 qml_mock_enabled = True
410 environment = {}
413 environment = {}
411
414
412 def setUp(self):
415 def setUp(self):
413 if model() != 'Desktop':
416 if model() != 'Desktop':
414− process_helpers.restart_unity()
417+ process_helpers.restart_unity_with_testability()
418+ process_helpers.unlock_unity()
419+ self.ensure_dash_not_running()
415
420
416 super(DashBaseTestCase, self).setUp()
421 super(DashBaseTestCase, self).setUp()
417
422
@@ -438,6 +443,10 @@ class DashBaseTestCase(AutopilotTestCase):
438 self.dash = self.dash_app.dash
443 self.dash = self.dash_app.dash
439 self.wait_for_dash()
444 self.wait_for_dash()
440
445
446+ def ensure_dash_not_running(self):
447+ if process_helpers.is_job_running('unity8-dash'):
448+ process_helpers.stop_job('unity8-dash')
449+
441 def launch_dash(self, binary_path, variables):
450 def launch_dash(self, binary_path, variables):
442 launch_dash_app_fixture = fixture_setup.LaunchDashApp(
451 launch_dash_app_fixture = fixture_setup.LaunchDashApp(
443 binary_path, variables)
452 binary_path, variables)