Merge lp:~om26er/ubuntu-autopilot-tests/test_fixtures into lp:ubuntu-autopilot-tests/ubuntu-experience-tests

Proposed by Omer Akram
Status: Merged
Merged at revision: 13
Proposed branch: lp:~om26er/ubuntu-autopilot-tests/test_fixtures
Merge into: lp:ubuntu-autopilot-tests/ubuntu-experience-tests
Diff against target: 189 lines (+115/-14)
6 files modified
ubuntu_integration_tests/__init__.py (+15/-6)
ubuntu_integration_tests/fixture_setup.py (+1/-1)
ubuntu_integration_tests/helpers.py (+1/-1)
ubuntu_integration_tests/tests/__init__.py (+12/-3)
ubuntu_integration_tests/tests/test_fixture_setup.py (+73/-0)
ubuntu_integration_tests/tests/test_osd_dialer_integration.py (+13/-3)
To merge this branch: bzr merge lp:~om26er/ubuntu-autopilot-tests/test_fixtures
Reviewer Review Type Date Requested Status
Chris Gagnon (community) Needs Fixing
PS Jenkins bot continuous-integration Approve
Ubuntu Testcase Admins Pending
Review via email: mp+207055@code.launchpad.net

Commit message

added tests for the environment fixtures

To post a comment you must log in.
14. By Omer Akram

argh, forgot to add the new tests file

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Chris Gagnon (chris.gagnon) wrote :

please add docstrings describing the goal of the tests, otherwise lgtm

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_integration_tests/__init__.py'
2--- ubuntu_integration_tests/__init__.py 2014-02-06 19:37:41 +0000
3+++ ubuntu_integration_tests/__init__.py 2014-02-18 22:19:55 +0000
4@@ -1,8 +1,17 @@
5 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
6-# Copyright 2014 Canonical
7-#
8-# This file is part of <>.
9-#
10-# dialer-app is free software: you can redistribute it and/or modify it
11-# under the terms of the GNU General Public License version 3, as published
12+#
13+# Copyright 2014 Canonical Ltd.
14+#
15+# This file is part of ubuntu-integration-tests.
16+#
17+# This program is free software; you can redistribute it and/or modify
18+# it under the terms of the GNU General Public License version 3, as published
19 # by the Free Software Foundation.
20+#
21+# This program is distributed in the hope that it will be useful,
22+# but WITHOUT ANY WARRANTY; without even the implied warranty of
23+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24+# GNU General Public License for more details.
25+#
26+# You should have received a copy of the GNU General Public License
27+# along with this program. If not, see <http://www.gnu.org/licenses/>
28
29=== modified file 'ubuntu_integration_tests/fixture_setup.py'
30--- ubuntu_integration_tests/fixture_setup.py 2014-02-08 14:47:33 +0000
31+++ ubuntu_integration_tests/fixture_setup.py 2014-02-18 22:19:55 +0000
32@@ -15,7 +15,7 @@
33 # GNU General Public License for more details.
34 #
35 # You should have received a copy of the GNU General Public License
36-# along with this program. If not, see <http://www.gnu.org/licenses/>.
37+# along with this program. If not, see <http://www.gnu.org/licenses/>
38
39 """Set up and clean up fixtures for the Inter-app integration tests."""
40
41
42=== modified file 'ubuntu_integration_tests/helpers.py'
43--- ubuntu_integration_tests/helpers.py 2014-02-08 14:47:33 +0000
44+++ ubuntu_integration_tests/helpers.py 2014-02-18 22:19:55 +0000
45@@ -15,7 +15,7 @@
46 # GNU General Public License for more details.
47 #
48 # You should have received a copy of the GNU General Public License
49-# along with this program. If not, see <http://www.gnu.org/licenses/>.
50+# along with this program. If not, see <http://www.gnu.org/licenses/>
51
52 """Helper functions to make writing Inter-app integration tests easier."""
53
54
55=== modified file 'ubuntu_integration_tests/tests/__init__.py'
56--- ubuntu_integration_tests/tests/__init__.py 2014-02-08 14:47:33 +0000
57+++ ubuntu_integration_tests/tests/__init__.py 2014-02-18 22:19:55 +0000
58@@ -1,12 +1,21 @@
59 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
60-# Copyright 2014 Canonical
61+#
62+# Copyright 2014 Canonical Ltd.
63 # Author: Omer Akram <omer.akram@canonical.com>
64 #
65 # This file is part of ubuntu-integration-tests.
66 #
67-# dialer-app is free software: you can redistribute it and/or modify it
68-# under the terms of the GNU General Public License version 3, as published
69+# This program is free software; you can redistribute it and/or modify
70+# it under the terms of the GNU General Public License version 3, as published
71 # by the Free Software Foundation.
72+#
73+# This program is distributed in the hope that it will be useful,
74+# but WITHOUT ANY WARRANTY; without even the implied warranty of
75+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
76+# GNU General Public License for more details.
77+#
78+# You should have received a copy of the GNU General Public License
79+# along with this program. If not, see <http://www.gnu.org/licenses/>
80
81 from autopilot.input import Touch, Pointer
82 from autopilot.testcase import AutopilotTestCase
83
84=== added file 'ubuntu_integration_tests/tests/test_fixture_setup.py'
85--- ubuntu_integration_tests/tests/test_fixture_setup.py 1970-01-01 00:00:00 +0000
86+++ ubuntu_integration_tests/tests/test_fixture_setup.py 2014-02-18 22:19:55 +0000
87@@ -0,0 +1,73 @@
88+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
89+#
90+# Copyright 2014 Canonical Ltd.
91+# Author: Omer Akram <omer.akram@canonical.com>
92+#
93+# This file is part of ubuntu-integration-tests.
94+#
95+# This program is free software; you can redistribute it and/or modify
96+# it under the terms of the GNU General Public License version 3, as published
97+# by the Free Software Foundation.
98+#
99+# This program is distributed in the hope that it will be useful,
100+# but WITHOUT ANY WARRANTY; without even the implied warranty of
101+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
102+# GNU General Public License for more details.
103+#
104+# You should have received a copy of the GNU General Public License
105+# along with this program. If not, see <http://www.gnu.org/licenses/>
106+
107+import subprocess
108+
109+import testtools
110+
111+from ubuntu_integration_tests import fixture_setup
112+
113+
114+class TestabilityEnvironmentTestCase(testtools.TestCase):
115+
116+ def setUp(self):
117+ super(TestabilityEnvironmentTestCase, self).setUp()
118+ old_var = self.get_environment_variable()
119+ self.addCleanup(self.set_environment_variable, old_var)
120+ self.set_environment_variable('dummy')
121+
122+ def get_environment_variable(self):
123+ try:
124+ return subprocess.check_output(
125+ [
126+ 'initctl',
127+ 'get-env',
128+ 'QT_LOAD_TESTABILITY'
129+ ]
130+ ).strip()
131+ except:
132+ return None
133+
134+ def set_environment_variable(self, value):
135+ subprocess.call(
136+ [
137+ '/sbin/initctl',
138+ 'set-env',
139+ 'QT_LOAD_TESTABILITY={}'.format(value)
140+ ]
141+ )
142+
143+ def test_fixture_must_setup_testability_environment(self):
144+ fixture = fixture_setup.TestabilityEnvironment()
145+ self.useFixture(fixture)
146+
147+ self.assertEquals('1', self.get_environment_variable())
148+
149+ def test_fixture_must_cleanup_testability_environment(self):
150+ fixture = fixture_setup.TestabilityEnvironment()
151+
152+ def inner_test():
153+ class TestWithFakeApplication(testtools.TestCase):
154+ def test_it(self):
155+ self.useFixture(fixture)
156+ return TestWithFakeApplication('test_it')
157+
158+ inner_test().run()
159+
160+ self.assertIsNone(self.get_environment_variable())
161
162=== modified file 'ubuntu_integration_tests/tests/test_osd_dialer_integration.py'
163--- ubuntu_integration_tests/tests/test_osd_dialer_integration.py 2014-02-08 14:47:33 +0000
164+++ ubuntu_integration_tests/tests/test_osd_dialer_integration.py 2014-02-18 22:19:55 +0000
165@@ -1,11 +1,21 @@
166 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
167-# Copyright 2014 Canonical
168+#
169+# Copyright 2014 Canonical Ltd.
170 # Author: Omer Akram <omer.akram@canonical.com>
171 #
172 # This file is part of ubuntu-integration-tests.
173-# dialer-app is free software: you can redistribute it and/or modify it
174-# under the terms of the GNU General Public License version 3, as published
175+#
176+# This program is free software; you can redistribute it and/or modify
177+# it under the terms of the GNU General Public License version 3, as published
178 # by the Free Software Foundation.
179+#
180+# This program is distributed in the hope that it will be useful,
181+# but WITHOUT ANY WARRANTY; without even the implied warranty of
182+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
183+# GNU General Public License for more details.
184+#
185+# You should have received a copy of the GNU General Public License
186+# along with this program. If not, see <http://www.gnu.org/licenses/>
187
188 from autopilot.matchers import Eventually
189 from autopilot.platform import model

Subscribers

People subscribed via source and target branches