on xenial help sign in
Make sure that unity is running and the dash is not.
commit5ee1d2fbf517e775cedecefa1adaf149883394f6 authorLeo Arias <leo.arias@canonical.com> dateWed 30 Jul 2014, 23:08 (12 years ago) parentd63d4fe
2 files changed+22−3
tests/autopilot/unity8/process_helpers.py+10 tests/autopilot/unity8/shell/tests/__init__.py+12−3
tests/autopilot/unity8/process_helpers.py+10
@@ -223,6 +223,16 @@ def stop_job(name):
223223 raise
224224
225225
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+
226236def _get_unity_status():
227237 try:
228238 return get_job_status('unity8')
tests/autopilot/unity8/shell/tests/__init__.py+12−3
@@ -35,7 +35,10 @@ import os.path
3535import subprocess
3636import sys
3737from testtools.matchers import Equals
38−from ubuntuuitoolkit import fixture_setup as toolkit_fixtures
38+from ubuntuuitoolkit import (
39+ fixture_setup as toolkit_fixtures,
40+ ubuntu_scenarios
41+)
3942
4043from unity8 import (
4144 get_lib_path,
@@ -405,13 +408,15 @@ class UnityTestCase(AutopilotTestCase):
405408
406409class DashBaseTestCase(AutopilotTestCase):
407410
408− scenarios = _get_device_emulation_scenarios()
411+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
409412 qml_mock_enabled = True
410413 environment = {}
411414
412415 def setUp(self):
413416 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()
415420
416421 super(DashBaseTestCase, self).setUp()
417422
@@ -438,6 +443,10 @@ class DashBaseTestCase(AutopilotTestCase):
438443 self.dash = self.dash_app.dash
439444 self.wait_for_dash()
440445
446+ def ensure_dash_not_running(self):
447+ if process_helpers.is_job_running('unity8-dash'):
448+ process_helpers.stop_job('unity8-dash')
449+
441450 def launch_dash(self, binary_path, variables):
442451 launch_dash_app_fixture = fixture_setup.LaunchDashApp(
443452 binary_path, variables)