Merge lp:~charlesk/unity8/indicator-tests into lp:unity8

Proposed by Charles Kerr on 2015-01-26
Status: Work in progress
Proposed branch: lp:~charlesk/unity8/indicator-tests
Merge into: lp:unity8
Diff against target: 111 lines (+45/-18)
2 files modified
tests/autopilot/unity8/indicators/tests/__init__.py (+35/-0)
tests/autopilot/unity8/indicators/tests/test_indicators.py (+10/-18)
To merge this branch: bzr merge lp:~charlesk/unity8/indicator-tests
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing on 2015-03-19
Allan LeSage 2015-01-26 Pending
Review via email: mp+247639@code.launchpad.net

Commit message

Description of the change

This branch is an attempt to track down the issues in https://code.launchpad.net/~indicator-applet-developers/unity8/indicator-power-autopilot-test/+merge/247079. Since Allan and I aren't able to reproduce the test failures locally, this is a "tracer" MP to try and find the problem.

To post a comment you must log in.
lp:~charlesk/unity8/indicator-tests updated on 2015-01-26
1525. By Charles Kerr on 2015-01-26

remove test_indicator_power.py

Albert Astals Cid (aacid) wrote :

Text conflict in tests/autopilot/unity8/indicators/tests/__init__.py
Text conflict in tests/autopilot/unity8/indicators/tests/test_indicators.py
2 conflicts encountered.

Albert Astals Cid (aacid) wrote :

I'll mark this as WiP since hasn't had the requested issues fixed for more than 2 months

Unmerged revisions

1525. By Charles Kerr on 2015-01-26

remove test_indicator_power.py

1524. By Charles Kerr on 2015-01-26

scaffolding only

1523. By Allan LeSage on 2015-01-13

Add proper assertion.

1522. By Allan LeSage on 2015-01-13

Mid-stream commit, moving around start-up, now a UnityTestCase.

1521. By Allan LeSage on 2014-12-19

Some experimental initctl changes.

1520. By Allan LeSage on 2014-12-18

Adding experimental indicator-power test, more to come.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/unity8/indicators/tests/__init__.py'
2--- tests/autopilot/unity8/indicators/tests/__init__.py 2014-03-27 22:07:43 +0000
3+++ tests/autopilot/unity8/indicators/tests/__init__.py 2015-01-26 22:01:01 +0000
4@@ -15,3 +15,38 @@
5 #
6 # You should have received a copy of the GNU General Public License
7 # along with this program. If not, see <http://www.gnu.org/licenses/>.
8+
9+from unity8 import process_helpers
10+from unity8.shell.tests import (
11+ UnityTestCase,
12+ _get_device_emulation_scenarios,
13+)
14+
15+
16+class IndicatorTestCase(UnityTestCase):
17+
18+ scenarios = _get_device_emulation_scenarios()
19+
20+ def setUp(self):
21+ super(IndicatorTestCase, self).setUp()
22+ self._dirty_services = set()
23+ self.unity_proxy = self.launch_unity()
24+ process_helpers.unlock_unity(self.unity_proxy)
25+
26+ def start_test_service(self, service_name, *args):
27+ """Restart a service (e.g. 'indicator-power-service') with test args.
28+
29+ Adds a no-arguments restart to addCleanup() so that the system
30+ can reset to a nontest version of the service when the tests finish.
31+ """
32+ self._start_service(service_name, *args)
33+ if service_name not in self._dirty_services:
34+ self._dirty_services.add(service_name)
35+ self.addCleanup(self._start_service, service_name)
36+
37+ @staticmethod
38+ def _start_service(service_name, *args):
39+ """Restart an upstart service; e.g. indicator-power-service"""
40+ if process_helpers.is_job_running(service_name):
41+ process_helpers.stop_job(service_name)
42+ process_helpers.start_job(service_name, *args)
43
44=== modified file 'tests/autopilot/unity8/indicators/tests/test_indicators.py'
45--- tests/autopilot/unity8/indicators/tests/test_indicators.py 2014-10-13 09:23:34 +0000
46+++ tests/autopilot/unity8/indicators/tests/test_indicators.py 2015-01-26 22:01:01 +0000
47@@ -18,24 +18,10 @@
48
49 from __future__ import absolute_import
50
51+from autopilot import platform
52 from testscenarios import multiply_scenarios
53
54-from autopilot import platform
55-
56-from unity8.process_helpers import unlock_unity
57-from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
58-
59-
60-class IndicatorTestCase(UnityTestCase):
61-
62- device_emulation_scenarios = _get_device_emulation_scenarios()
63-
64- def setUp(self):
65- if platform.model() == 'Desktop':
66- self.skipTest('Test cannot be run on the desktop.')
67- super(IndicatorTestCase, self).setUp()
68- self.unity_proxy = self.launch_unity()
69- unlock_unity(self.unity_proxy)
70+from unity8.indicators.tests import IndicatorTestCase
71
72
73 class IndicatorExistsTestCase(IndicatorTestCase):
74@@ -51,7 +37,7 @@
75 ]
76 scenarios = multiply_scenarios(
77 indicator_scenarios,
78- IndicatorTestCase.device_emulation_scenarios
79+ IndicatorTestCase.scenarios
80 )
81
82 def setUp(self):
83@@ -59,6 +45,9 @@
84 if (platform.model() == 'Nexus 10' and
85 self.indicator_name == 'indicator-bluetooth'):
86 self.skipTest('Nexus 10 does not have bluetooth at the moment.')
87+ if platform.model() == 'Desktop':
88+ # names exported differently in unity7
89+ self.skipTest('Test cannot be run on the desktop.')
90
91 def test_indicator_exists(self):
92 self.main_window._get_indicator_panel_item(
93@@ -86,7 +75,7 @@
94 ]
95 scenarios = multiply_scenarios(
96 indicator_scenarios,
97- IndicatorTestCase.device_emulation_scenarios
98+ IndicatorTestCase.scenarios
99 )
100
101 def setUp(self):
102@@ -94,6 +83,9 @@
103 if (platform.model() == 'Nexus 10' and
104 self.indicator_name == 'indicator-bluetooth'):
105 self.skipTest('Nexus 10 does not have bluetooth at the moment.')
106+ if platform.model() == 'Desktop':
107+ # names exported differently in unity7
108+ self.skipTest('Test cannot be run on the desktop.')
109
110 def test_indicator_page_title_matches_widget(self):
111 """Swiping open an indicator must show its correct title.

Subscribers

People subscribed via source and target branches