Merge lp:~thomir-deactivatedaccount/autopilot/split-tests into lp:autopilot

Proposed by Thomi Richards
Status: Merged
Approved by: Thomi Richards
Approved revision: 198
Merged at revision: 196
Proposed branch: lp:~thomir-deactivatedaccount/autopilot/split-tests
Merge into: lp:autopilot
Diff against target: 176 lines (+87/-20)
7 files modified
autopilot/tests/README (+4/-0)
autopilot/tests/functional/__init__.py (+18/-0)
autopilot/tests/functional/test_application_mixin.py (+43/-0)
autopilot/tests/unit/__init__.py (+18/-0)
autopilot/tests/unit/test_application_mixin.py (+1/-20)
debian/control (+1/-0)
debian/rules (+2/-0)
To merge this branch: bzr merge lp:~thomir-deactivatedaccount/autopilot/split-tests
Reviewer Review Type Date Requested Status
Francis Ginther Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+162527@code.launchpad.net

Commit message

Split tests into unit and functional tests. Make sure unit tests are run as part of the package build.

Description of the change

This branch splits the autopilot tests into unit tests, and functional tests. It also causes the unit tests to be run as part of the package build process. My hope is that as time goe3s on we will write more and more unit tests, and find a way to run the functional tests as part of our autolanding infrastructure.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
197. By Thomi Richards

Moved test that relied on gedit into the functional section. Added python-mock as a build-dep, so we can run the unit tests.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
198. By Thomi Richards

revert accidental change to debian/source/format

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Francis Ginther (fginther) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'autopilot/tests/README'
2--- autopilot/tests/README 1970-01-01 00:00:00 +0000
3+++ autopilot/tests/README 2013-05-05 21:50:33 +0000
4@@ -0,0 +1,4 @@
5+This is the root directory for autopilot tests. The "unit" folder contains unit tests that are run when the autopilot packae builds. They must not have any external dependancies (especially not to, for example X11). The "functional" folder contains larger tests that may depend on external components.
6+
7+Both these folders are packages in the 'python-autopilot-tests' package.
8+
9
10=== added directory 'autopilot/tests/functional'
11=== added file 'autopilot/tests/functional/__init__.py'
12--- autopilot/tests/functional/__init__.py 1970-01-01 00:00:00 +0000
13+++ autopilot/tests/functional/__init__.py 2013-05-05 21:50:33 +0000
14@@ -0,0 +1,18 @@
15+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
16+#
17+# Autopilot Functional Test Tool
18+# Copyright (C) 2012-2013 Canonical
19+#
20+# This program is free software: you can redistribute it and/or modify
21+# it under the terms of the GNU General Public License as published by
22+# the Free Software Foundation, either version 3 of the License, or
23+# (at your option) any later version.
24+#
25+# This program is distributed in the hope that it will be useful,
26+# but WITHOUT ANY WARRANTY; without even the implied warranty of
27+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28+# GNU General Public License for more details.
29+#
30+# You should have received a copy of the GNU General Public License
31+# along with this program. If not, see <http://www.gnu.org/licenses/>.
32+#
33
34=== renamed file 'autopilot/tests/test_ap_apps.py' => 'autopilot/tests/functional/test_ap_apps.py'
35=== added file 'autopilot/tests/functional/test_application_mixin.py'
36--- autopilot/tests/functional/test_application_mixin.py 1970-01-01 00:00:00 +0000
37+++ autopilot/tests/functional/test_application_mixin.py 2013-05-05 21:50:33 +0000
38@@ -0,0 +1,43 @@
39+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
40+#
41+# Autopilot Functional Test Tool
42+# Copyright (C) 2012-2013 Canonical
43+#
44+# This program is free software: you can redistribute it and/or modify
45+# it under the terms of the GNU General Public License as published by
46+# the Free Software Foundation, either version 3 of the License, or
47+# (at your option) any later version.
48+#
49+# This program is distributed in the hope that it will be useful,
50+# but WITHOUT ANY WARRANTY; without even the implied warranty of
51+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
52+# GNU General Public License for more details.
53+#
54+# You should have received a copy of the GNU General Public License
55+# along with this program. If not, see <http://www.gnu.org/licenses/>.
56+#
57+
58+
59+from __future__ import absolute_import
60+
61+from autopilot.testcase import AutopilotTestCase
62+from testtools.matchers import raises
63+
64+
65+class ApplicationSupportTests(AutopilotTestCase):
66+
67+ def test_launch_raises_ValueError_on_unknown_kwargs(self):
68+ """launch_test_application must raise ValueError when given unknown
69+ keyword arguments.
70+
71+ """
72+ fn = lambda: self.launch_test_application('gedit', arg1=123, arg2='asd')
73+ self.assertThat(fn, raises(ValueError("Unknown keyword arguments: 'arg1', 'arg2'.")))
74+
75+ def test_launch_raises_ValueError_on_unknown_kwargs_with_known(self):
76+ """launch_test_application must raise ValueError when given unknown
77+ keyword arguments.
78+
79+ """
80+ fn = lambda: self.launch_test_application('gedit', arg1=123, arg2='asd', launch_dir='/')
81+ self.assertThat(fn, raises(ValueError("Unknown keyword arguments: 'arg1', 'arg2'.")))
82
83=== renamed file 'autopilot/tests/test_autopilot_functional.py' => 'autopilot/tests/functional/test_autopilot_functional.py'
84=== renamed file 'autopilot/tests/test_dbus_query.py' => 'autopilot/tests/functional/test_dbus_query.py'
85=== renamed file 'autopilot/tests/test_input_stack.py' => 'autopilot/tests/functional/test_input_stack.py'
86=== renamed file 'autopilot/tests/test_mouse_emulator.py' => 'autopilot/tests/functional/test_mouse_emulator.py'
87=== renamed file 'autopilot/tests/test_open_window.py' => 'autopilot/tests/functional/test_open_window.py'
88=== renamed file 'autopilot/tests/test_process_emulator.py' => 'autopilot/tests/functional/test_process_emulator.py'
89=== added directory 'autopilot/tests/unit'
90=== added file 'autopilot/tests/unit/__init__.py'
91--- autopilot/tests/unit/__init__.py 1970-01-01 00:00:00 +0000
92+++ autopilot/tests/unit/__init__.py 2013-05-05 21:50:33 +0000
93@@ -0,0 +1,18 @@
94+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
95+#
96+# Autopilot Functional Test Tool
97+# Copyright (C) 2012-2013 Canonical
98+#
99+# This program is free software: you can redistribute it and/or modify
100+# it under the terms of the GNU General Public License as published by
101+# the Free Software Foundation, either version 3 of the License, or
102+# (at your option) any later version.
103+#
104+# This program is distributed in the hope that it will be useful,
105+# but WITHOUT ANY WARRANTY; without even the implied warranty of
106+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
107+# GNU General Public License for more details.
108+#
109+# You should have received a copy of the GNU General Public License
110+# along with this program. If not, see <http://www.gnu.org/licenses/>.
111+#
112
113=== renamed file 'autopilot/tests/test_application_mixin.py' => 'autopilot/tests/unit/test_application_mixin.py'
114--- autopilot/tests/test_application_mixin.py 2013-04-23 04:15:54 +0000
115+++ autopilot/tests/unit/test_application_mixin.py 2013-05-05 21:50:33 +0000
116@@ -21,10 +21,7 @@
117 from __future__ import absolute_import
118
119 from autopilot.testcase import AutopilotTestCase
120-from testtools.matchers import Is, Not, raises
121-
122-def dummy_addCleanup(*args, **kwargs):
123- pass
124+from testtools.matchers import raises
125
126
127 class ApplicationSupportTests(AutopilotTestCase):
128@@ -40,19 +37,3 @@
129 self.assertThat(lambda: self.launch_test_application(None), raises(TypeError))
130 self.assertThat(lambda: self.launch_test_application([]), raises(TypeError))
131 self.assertThat(lambda: self.launch_test_application((None,)), raises(TypeError))
132-
133- def test_launch_raises_ValueError_on_unknown_kwargs(self):
134- """launch_test_application must raise ValueError when given unknown
135- keyword arguments.
136-
137- """
138- fn = lambda: self.launch_test_application('gedit', arg1=123, arg2='asd')
139- self.assertThat(fn, raises(ValueError("Unknown keyword arguments: 'arg1', 'arg2'.")))
140-
141- def test_launch_raises_ValueError_on_unknown_kwargs_with_known(self):
142- """launch_test_application must raise ValueError when given unknown
143- keyword arguments.
144-
145- """
146- fn = lambda: self.launch_test_application('gedit', arg1=123, arg2='asd', launch_dir='/')
147- self.assertThat(fn, raises(ValueError("Unknown keyword arguments: 'arg1', 'arg2'.")))
148
149=== renamed file 'autopilot/tests/test_backend.py' => 'autopilot/tests/unit/test_backend.py'
150=== renamed file 'autopilot/tests/test_custom_assertions.py' => 'autopilot/tests/unit/test_custom_assertions.py'
151=== renamed file 'autopilot/tests/test_custom_exceptions.py' => 'autopilot/tests/unit/test_custom_exceptions.py'
152=== renamed file 'autopilot/tests/test_matchers.py' => 'autopilot/tests/unit/test_matchers.py'
153=== renamed file 'autopilot/tests/test_out_of_test_addcleanup.py' => 'autopilot/tests/unit/test_out_of_test_addcleanup.py'
154=== renamed file 'autopilot/tests/test_pick_backend.py' => 'autopilot/tests/unit/test_pick_backend.py'
155=== renamed file 'autopilot/tests/test_platform.py' => 'autopilot/tests/unit/test_platform.py'
156=== modified file 'debian/control'
157--- debian/control 2013-05-03 00:15:26 +0000
158+++ debian/control 2013-05-05 21:50:33 +0000
159@@ -10,6 +10,7 @@
160 python (>= 2.6),
161 python-dbus,
162 python-debian,
163+ python-mock,
164 python-setuptools,
165 python-sphinx,
166 python-testtools,
167
168=== modified file 'debian/rules'
169--- debian/rules 2013-04-22 02:23:52 +0000
170+++ debian/rules 2013-05-05 21:50:33 +0000
171@@ -11,3 +11,5 @@
172 sphinx-build -b html -W docs/ docs/_build/html/
173 dh_auto_build
174
175+override_dh_auto_test:
176+ python -m testtools.run discover autopilot.tests.unit

Subscribers

People subscribed via source and target branches