Merge lp:autopilot into lp:autopilot/overlay

Proposed by Christopher Lee
Status: Superseded
Proposed branch: lp:autopilot
Merge into: lp:autopilot/overlay
Diff against target: 626 lines (+303/-39)
17 files modified
README (+2/-2)
autopilot/_fixtures.py (+78/-0)
autopilot/exceptions.py (+3/-3)
autopilot/input/__init__.py (+1/-1)
autopilot/introspection/dbus.py (+38/-1)
autopilot/run.py (+1/-1)
autopilot/testcase.py (+6/-0)
autopilot/tests/functional/test_input_stack.py (+7/-4)
autopilot/tests/functional/test_introspection_features.py (+29/-0)
autopilot/tests/unit/test_exceptions.py (+3/-3)
autopilot/tests/unit/test_fixtures.py (+58/-4)
autopilot/tests/unit/test_introspection_dbus.py (+42/-0)
autopilot/tests/unit/test_test_fixtures.py (+2/-2)
bin/autopilot3-sandbox-run (+30/-15)
debian/control (+1/-0)
debian/rules (+1/-1)
setup.py (+1/-2)
To merge this branch: bzr merge lp:autopilot
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Canonical Platform QA Team Pending
Review via email: mp+269825@code.launchpad.net

This proposal has been superseded by a proposal from 2015-09-02.

Commit message

Flake8 fix for FTBFS due to new flake8.

Description of the change

Flake8 fix for FTBFS due to new flake8.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:autopilot updated
571. By Christopher Lee

Allow to use custom launcher when launching application.

Approved by PS Jenkins bot.

572. By Christopher Lee

Add functionality in autopilot that exists in recent testtools (not yet available on Ubuntu).

Approved by Selene Scriven, PS Jenkins bot.

573. By Christopher Lee

Fix build issues on Xenial. Incl. simplifying DateTime. Fixes: https://bugs.launchpad.net/bugs/1524000.

Approved by Max Brustkern, PS Jenkins bot.

574. By Christopher Lee

Fix missing dep packaging.

Approved by PS Jenkins bot.

575. By Iain Lane

psutil.Process.get_children is removed, use children instead.

Approved by Christopher Lee, PS Jenkins bot.

576. By Andrea Cerisara

Refactored autopilot.input._X11.Mouse.move_to_object. Fixes: https://bugs.launchpad.net/bugs/1308330.

Approved by platform-qa-bot, Nicholas Skaggs, PS Jenkins bot.

577. By Christopher Lee

Add a final filter that ignores any children processes if the parent process matches and the supplied pid is the parents. . Fixes: https://bugs.launchpad.net/bugs/1569079.

Approved by Thomi Richards, platform-qa-bot, PS Jenkins bot.

578. By Albert Astals Cid

The s of seconds is lowercase.

Approved by Max Brustkern, PS Jenkins bot, platform-qa-bot.

579. By Omer Akram

Upstream custom helpers in lp:ubuntu-system-tests to autopilot.

Approved by Richard Huddie, platform-qa-bot, Santiago Baldassin.

580. By Omer Akram

* Change *_select_many methods to optionally return sorted results
* Create UInput device for power button emulation
* Method: to get path of a dbus object
* Method: wait_until_not_moving().

Approved by platform-qa-bot, Richard Huddie, Santiago Baldassin.

581. By Omer Akram

Prepare for 1.6.0 release.

Approved by Christopher Lee, platform-qa-bot.

582. By CI Train Bot Account

sync debian/changelog from 1.5 and 1.6 branches.

Approved by Santiago Baldassin, platform-qa-bot.

583. By Omer Akram

Housekeeping: Remove commented code, other redundancies.

Approved by Richard Huddie, platform-qa-bot.

584. By Omer Akram

Enable autopilot to work under Mir based desktop
  * Stop relying on fbset to get resolution
  * Don't wait for BAMF dbus interface under Mir based systems(perf boost)
  * UPA/UInput are now the preferred backends for Input.

Approved by platform-qa-bot, Santiago Baldassin.

585. By Omer Akram

Fix build.

Approved by Richard Huddie, platform-qa-bot.

586. By Santiago Baldassin

Adding default resolutions

587. By Santiago Baldassin

Adding default resolutions for M10 and desktop and removing non supported devices

588. By Santiago Baldassin

fixing flake8 errors

589. By Santiago Baldassin

minor fix

590. By Santiago Baldassin

Adding release information to the README.

Approved by Santiago Baldassin, platform-qa-bot.

591. By Jeremy Bícha

Drop unused gconf dependency
Fix Vcs-Bzr link.

Approved by platform-qa-bot, Rodney Dawes.

592. By dobey

Update dependency for ubuntu-app-launch API break.
Get logs directly from systemd journal now, for ual launched apps.

Approved by Omer Akram, Santiago Baldassin, platform-qa-bot.

593. By Santiago Baldassin

Restoring backends order. Fixes: https://bugs.launchpad.net/bugs/1671155.

Approved by Richard Huddie, platform-qa-bot, Heber Parrucci.

594. By Richard Huddie

Fix zesty package building. Fixes: https://bugs.launchpad.net/bugs/1679574.

Approved by Santiago Baldassin, platform-qa-bot.

595. By Łukasz Zemczak

Get rid of the conditional dependency of gir1.2-ubuntu-app-launch-2 - it's no longer built from any source.

Approved by platform-qa-bot, Santiago Baldassin, Richard Huddie.

Unmerged revisions

595. By Łukasz Zemczak

Get rid of the conditional dependency of gir1.2-ubuntu-app-launch-2 - it's no longer built from any source.

Approved by platform-qa-bot, Santiago Baldassin, Richard Huddie.

594. By Richard Huddie

Fix zesty package building. Fixes: https://bugs.launchpad.net/bugs/1679574.

Approved by Santiago Baldassin, platform-qa-bot.

593. By Santiago Baldassin

Restoring backends order. Fixes: https://bugs.launchpad.net/bugs/1671155.

Approved by Richard Huddie, platform-qa-bot, Heber Parrucci.

592. By dobey

Update dependency for ubuntu-app-launch API break.
Get logs directly from systemd journal now, for ual launched apps.

Approved by Omer Akram, Santiago Baldassin, platform-qa-bot.

591. By Jeremy Bícha

Drop unused gconf dependency
Fix Vcs-Bzr link.

Approved by platform-qa-bot, Rodney Dawes.

590. By Santiago Baldassin

Adding release information to the README.

Approved by Santiago Baldassin, platform-qa-bot.

589. By Santiago Baldassin

minor fix

588. By Santiago Baldassin

fixing flake8 errors

587. By Santiago Baldassin

Adding default resolutions for M10 and desktop and removing non supported devices

586. By Santiago Baldassin

Adding default resolutions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README'
2--- README 2015-01-22 00:58:22 +0000
3+++ README 2015-09-01 23:45:04 +0000
4@@ -12,7 +12,7 @@
5 https://launchpad.net/autopilot
6
7 - Documentation (Tutorial, FAQ, API Reference, etc):
8- https://developer.ubuntu.com/api/devel/ubuntu-14.10/python/autopilot/
9+ https://developer.ubuntu.com/api/autopilot/python/1.5.0/
10
11 - IRC channel is #ubuntu-autopilot on irc.freenode.net
12
13@@ -67,7 +67,7 @@
14
15 For a more complete explanation for running or listing tests please see the
16 full documentation found here:
17-https://developer.ubuntu.com/api/devel/ubuntu-14.10/python/autopilot/tutorial/running_ap.html
18+https://developer.ubuntu.com/api/autopilot/python/1.5.0/guides-running_ap/
19
20 If you are in the root of the autopilot source tree this will run/list the tests from
21 within that local module. Otherwise autopilot will look in the system python path.
22
23=== modified file 'autopilot/_fixtures.py'
24--- autopilot/_fixtures.py 2014-07-09 03:09:29 +0000
25+++ autopilot/_fixtures.py 2015-09-01 23:45:04 +0000
26@@ -18,6 +18,10 @@
27 #
28
29 from fixtures import Fixture
30+import logging
31+from gi.repository import Gio
32+
33+logger = logging.getLogger(__name__)
34
35
36 class FixtureWithDirectAddDetail(Fixture):
37@@ -40,3 +44,77 @@
38 """
39 super().__init__()
40 self.caseAddDetail = caseAddDetail or self.addDetail
41+
42+
43+class OSKAlwaysEnabled(Fixture):
44+ """Enable the OSK to be shown regardless of if there is a keyboard (virtual
45+ or real) plugged in.
46+
47+ This is a workaround for bug lp:1474444
48+
49+ """
50+
51+ osk_schema = 'com.canonical.keyboard.maliit'
52+ osk_show_key = 'stay-hidden'
53+
54+ def setUp(self):
55+ super().setUp()
56+
57+ try:
58+ _original_value = get_bool_gsettings_value(
59+ self.osk_schema,
60+ self.osk_show_key
61+ )
62+ set_bool_gsettings_value(
63+ self.osk_schema,
64+ self.osk_show_key,
65+ False
66+ )
67+ self.addCleanup(
68+ set_bool_gsettings_value,
69+ self.osk_schema,
70+ self.osk_show_key,
71+ _original_value
72+ )
73+ except ValueError as e:
74+ logger.warning('Failed to set OSK gsetting: {}'.format(e))
75+
76+
77+def get_bool_gsettings_value(schema, key):
78+ """Return the boolean value for schema/key combo.
79+
80+ :raises ValueError: If either ``schema`` or ``key`` are not valid.
81+
82+ """
83+ setting = _gsetting_get_setting(schema, key)
84+
85+ return setting.get_boolean(key)
86+
87+
88+def set_bool_gsettings_value(schema, key, value):
89+ """Set the boolean value ``value`` for schema/key combo.
90+
91+ :raises ValueError: If either ``schema`` or ``key`` are not valid.
92+
93+ """
94+
95+ setting = _gsetting_get_setting(schema, key)
96+
97+ setting.set_boolean(key, value)
98+
99+
100+def _gsetting_get_setting(schema, key):
101+ if schema not in Gio.Settings.list_schemas():
102+ raise ValueError('schema {} is not installed.'.format(schema))
103+
104+ setting = Gio.Settings.new(schema)
105+
106+ if key not in setting.keys():
107+ raise ValueError(
108+ 'key \'{key}\' is not available for schema \'{schema}\''.format(
109+ key=key,
110+ schema=schema
111+ )
112+ )
113+
114+ return setting
115
116=== modified file 'autopilot/exceptions.py'
117--- autopilot/exceptions.py 2014-07-22 04:06:13 +0000
118+++ autopilot/exceptions.py 2015-09-01 23:45:04 +0000
119@@ -89,10 +89,10 @@
120 )
121
122 _troubleshoot_url_message = (
123- 'Tips on minimizing the occurrence of this failure'
124+ 'Tips on minimizing the occurrence of this failure '
125 'are available here: '
126- 'http://developer.ubuntu.com/api/devel/ubuntu-14.10/python/'
127- 'autopilot/faq/troubleshooting.html'
128+ 'https://developer.ubuntu.com/api/autopilot/python/1.5.0/'
129+ 'faq-troubleshooting/'
130 )
131
132 def __str__(self):
133
134=== modified file 'autopilot/input/__init__.py'
135--- autopilot/input/__init__.py 2015-03-22 06:21:47 +0000
136+++ autopilot/input/__init__.py 2015-09-01 23:45:04 +0000
137@@ -129,7 +129,7 @@
138 return _pick_backend(backends, preferred_backend)
139
140 @contextmanager
141- def focused_type(self, input_target, pointer=None):
142+ def focused_type(self, input_target, pointer=None):
143 """Type into an input widget.
144
145 This context manager takes care of making sure a particular
146
147=== modified file 'autopilot/introspection/dbus.py'
148--- autopilot/introspection/dbus.py 2014-07-31 04:42:08 +0000
149+++ autopilot/introspection/dbus.py 2015-09-01 23:45:04 +0000
150@@ -544,6 +544,36 @@
151 class_name = cls.__name__.encode('utf-8')
152 return state_name == class_name
153
154+ @classmethod
155+ def get_type_query_name(cls):
156+ """Return the Type node name to use within the search query.
157+
158+ This allows for a Custom Proxy Object to be named differently to the
159+ underlying node type name.
160+
161+ For instance if you have a QML type defined in the file RedRect.qml::
162+
163+ import QtQuick 2.0
164+ Rectangle {
165+ color: red;
166+ }
167+
168+ You can then define a Custom Proxy Object for this type like so::
169+
170+ class RedRect(DBusIntrospectionObject):
171+ @classmethod
172+ def get_type_query_name(cls):
173+ return 'QQuickRectangle'
174+
175+ This is due to the qml engine storing 'RedRect' as a QQuickRectangle in
176+ the UI tree and the xpathquery query needs a node type to query for.
177+ By default the query will use the class name (in this case RedRect) but
178+ this will not match any node type in the tree.
179+
180+ """
181+
182+ return cls.__name__
183+
184
185 # TODO - can we add a deprecation warning around this somehow?
186 CustomEmulatorBase = DBusIntrospectionObject
187@@ -557,5 +587,12 @@
188
189 """
190 if not isinstance(maybe_string_or_class, str):
191- return maybe_string_or_class.__name__
192+ return _get_class_type_name(maybe_string_or_class)
193 return maybe_string_or_class
194+
195+
196+def _get_class_type_name(maybe_cpo_class):
197+ if hasattr(maybe_cpo_class, 'get_type_query_name'):
198+ return maybe_cpo_class.get_type_query_name()
199+ else:
200+ return maybe_cpo_class.__name__
201
202=== modified file 'autopilot/run.py'
203--- autopilot/run.py 2015-05-05 03:09:21 +0000
204+++ autopilot/run.py 2015-09-01 23:45:04 +0000
205@@ -214,7 +214,7 @@
206
207 class _OneOrMoreArgumentStoreAction(Action):
208
209- def __call__(self, parser, namespace, values, option_string=None):
210+ def __call__(self, parser, namespace, values, option_string=None):
211 if len(values) == 0:
212 parser.error(
213 "Must specify at least one argument to the 'launch' command")
214
215=== modified file 'autopilot/testcase.py'
216--- autopilot/testcase.py 2015-03-25 14:13:27 +0000
217+++ autopilot/testcase.py 2015-09-01 23:45:04 +0000
218@@ -69,6 +69,7 @@
219 from autopilot.platform import get_display_server
220 from autopilot.process import ProcessManager
221 from autopilot.utilities import deprecated, on_test_started
222+from autopilot._fixtures import OSKAlwaysEnabled
223 from autopilot._timeout import Timeout
224 from autopilot._logging import TestCaseLoggingFixture
225 from autopilot._video import get_video_recording_fixture
226@@ -164,6 +165,11 @@
227 self._display = None
228 self._kb = Keyboard.create()
229
230+ # Instatiate this after keyboard creation to ensure it doesn't get
231+ # overwritten
232+ # Workaround for bug lp:1474444
233+ self.useFixture(OSKAlwaysEnabled())
234+
235 # Work around for bug lp:1297592.
236 _ensure_uinput_device_created()
237
238
239=== modified file 'autopilot/tests/functional/test_input_stack.py'
240--- autopilot/tests/functional/test_input_stack.py 2015-05-08 04:32:51 +0000
241+++ autopilot/tests/functional/test_input_stack.py 2015-09-01 23:45:04 +0000
242@@ -1,3 +1,4 @@
243+
244 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
245 #
246 # Autopilot Functional Test Tool
247@@ -189,9 +190,11 @@
248 from autopilot.input import _uinput
249 return _uinput.Keyboard._device._pressed_keys_ecodes
250 else:
251- self.fail("Don't know how to get pressed keys list for backend "
252- + self.backend
253- )
254+ self.fail(
255+ "Don't know how to get pressed keys list for {}".format(
256+ self.backend
257+ )
258+ )
259
260
261 @skipIf(platform.model() != "Desktop", "Only suitable on Desktop (WinMocker)")
262@@ -379,7 +382,7 @@
263 screen_geometry = Display.create().get_screen_geometry(0)
264 target_x = screen_geometry[0] + 10
265 target_y = screen_geometry[1] + 10.6
266- self.device.move(target_x, target_y)
267+ device.move(target_x, target_y)
268 self.assertEqual(device.position(), (target_x, int(target_y)))
269
270 @patch('autopilot.platform.model', new=lambda *args: "Not Desktop", )
271
272=== modified file 'autopilot/tests/functional/test_introspection_features.py'
273--- autopilot/tests/functional/test_introspection_features.py 2015-04-30 03:34:13 +0000
274+++ autopilot/tests/functional/test_introspection_features.py 2015-09-01 23:45:04 +0000
275@@ -42,6 +42,7 @@
276 from autopilot import platform
277 from autopilot.matchers import Eventually
278 from autopilot.testcase import AutopilotTestCase
279+from autopilot.tests.functional import QmlScriptRunnerMixin
280 from autopilot.tests.functional.fixtures import TempDesktopFile
281 from autopilot.introspection import CustomEmulatorBase
282 from autopilot.introspection import _object_registry as object_registry
283@@ -397,3 +398,31 @@
284 [e[1] for e in result2.decorated.errors]
285 )
286 )
287+
288+
289+class CustomCPOTest(AutopilotTestCase, QmlScriptRunnerMixin):
290+
291+ def launch_simple_qml_script(self):
292+ simple_script = dedent("""
293+ import QtQuick 2.0
294+ Rectangle {
295+ objectName: "ExampleRectangle"
296+ }
297+ """)
298+ return self.start_qml_script(simple_script)
299+
300+ def test_cpo_can_be_named_different_to_underlying_type(self):
301+ """A CPO with the correct name match method must be matched if the
302+ class name is different to the Type name.
303+
304+ """
305+ with object_registry.patch_registry({}):
306+ class RandomNamedCPORectangle(CustomEmulatorBase):
307+ @classmethod
308+ def get_type_query_name(cls):
309+ return 'QQuickRectangle'
310+
311+ app = self.launch_simple_qml_script()
312+ rectangle = app.select_single(RandomNamedCPORectangle)
313+
314+ self.assertThat(rectangle.objectName, Equals('ExampleRectangle'))
315
316=== modified file 'autopilot/tests/unit/test_exceptions.py'
317--- autopilot/tests/unit/test_exceptions.py 2014-07-22 02:39:26 +0000
318+++ autopilot/tests/unit/test_exceptions.py 2015-09-01 23:45:04 +0000
319@@ -76,9 +76,9 @@
320 self.assertThat(
321 str(err),
322 EndsWith(
323- 'Tips on minimizing the occurrence of this failure'
324+ 'Tips on minimizing the occurrence of this failure '
325 'are available here: '
326- 'http://developer.ubuntu.com/api/devel/ubuntu-14.10/python/'
327- 'autopilot/faq/troubleshooting.html'
328+ 'https://developer.ubuntu.com/api/autopilot/python/1.5.0/'
329+ 'faq-troubleshooting/'
330 )
331 )
332
333=== modified file 'autopilot/tests/unit/test_fixtures.py'
334--- autopilot/tests/unit/test_fixtures.py 2014-07-09 03:04:46 +0000
335+++ autopilot/tests/unit/test_fixtures.py 2015-09-01 23:45:04 +0000
336@@ -19,16 +19,70 @@
337
338
339 from testtools import TestCase
340-
341-from autopilot._fixtures import FixtureWithDirectAddDetail
342+from testtools.matchers import raises
343+from unittest.mock import patch, Mock
344+import autopilot._fixtures as ap_fixtures
345
346
347 class FixtureWithDirectAddDetailTests(TestCase):
348
349 def test_sets_caseAddDetail_method(self):
350- fixture = FixtureWithDirectAddDetail(self.addDetail)
351+ fixture = ap_fixtures.FixtureWithDirectAddDetail(self.addDetail)
352 self.assertEqual(fixture.caseAddDetail, self.addDetail)
353
354 def test_can_construct_without_arguments(self):
355- fixture = FixtureWithDirectAddDetail()
356+ fixture = ap_fixtures.FixtureWithDirectAddDetail()
357 self.assertEqual(fixture.caseAddDetail, fixture.addDetail)
358+
359+
360+class GSettingsAccessTests(TestCase):
361+
362+ def test_incorrect_schema_raises_exception(self):
363+ self.assertThat(
364+ lambda: ap_fixtures._gsetting_get_setting('com.foo.', 'baz'),
365+ raises(ValueError)
366+ )
367+
368+ def test_incorrect_key_raises_exception(self):
369+ self.assertThat(
370+ lambda: ap_fixtures._gsetting_get_setting(
371+ 'org.gnome.system.locale',
372+ 'baz'
373+ ),
374+ raises(ValueError)
375+ )
376+
377+ def test_get_value_returns_expected_value(self):
378+ with patch.object(ap_fixtures, '_gsetting_get_setting') as get_setting:
379+ setting = Mock()
380+ setting.get_boolean.return_value = True
381+ get_setting.return_value = setting
382+ self.assertEqual(
383+ ap_fixtures.get_bool_gsettings_value('foo', 'bar'),
384+ True
385+ )
386+
387+
388+class OSKAlwaysEnabledTests(TestCase):
389+
390+ @patch.object(ap_fixtures, '_gsetting_get_setting')
391+ def test_sets_stayhidden_to_False(self, gs):
392+ with patch.object(ap_fixtures, 'set_bool_gsettings_value') as set_gs:
393+ with ap_fixtures.OSKAlwaysEnabled():
394+ set_gs.assert_called_once_with(
395+ 'com.canonical.keyboard.maliit',
396+ 'stay-hidden',
397+ False
398+ )
399+
400+ def test_resets_value_to_original(self):
401+ with patch.object(ap_fixtures, 'set_bool_gsettings_value') as set_gs:
402+ with patch.object(ap_fixtures, 'get_bool_gsettings_value') as get_gs: # NOQA
403+ get_gs.return_value = 'foo'
404+ with ap_fixtures.OSKAlwaysEnabled():
405+ pass
406+ set_gs.assert_called_with(
407+ 'com.canonical.keyboard.maliit',
408+ 'stay-hidden',
409+ 'foo'
410+ )
411
412=== modified file 'autopilot/tests/unit/test_introspection_dbus.py'
413--- autopilot/tests/unit/test_introspection_dbus.py 2014-07-22 02:30:19 +0000
414+++ autopilot/tests/unit/test_introspection_dbus.py 2015-09-01 23:45:04 +0000
415@@ -118,6 +118,28 @@
416 ),
417 )
418
419+ def test_base_class_provides_correct_query_name(self):
420+ self.assertThat(
421+ dbus.DBusIntrospectionObject.get_type_query_name(),
422+ Equals('ProxyBase')
423+ )
424+
425+ def test_inherited_uses_default_get_node_name(self):
426+ class TestCPO(dbus.DBusIntrospectionObject):
427+ pass
428+
429+ self.assertThat(
430+ TestCPO.get_type_query_name(),
431+ Equals('TestCPO')
432+ )
433+
434+ def test_inherited_overwrites_node_name_is_correct(self):
435+ class TestCPO(dbus.DBusIntrospectionObject):
436+ @classmethod
437+ def get_type_query_name(cls):
438+ return "TestCPO"
439+ self.assertThat(TestCPO.get_type_query_name(), Equals("TestCPO"))
440+
441
442 class ProxyObjectPrintTreeTests(TestCase):
443
444@@ -222,3 +244,23 @@
445 class FooBarBaz(object):
446 pass
447 self.assertEqual("FooBarBaz", dbus.get_type_name(FooBarBaz))
448+
449+ def test_get_type_name_returns_classname(self):
450+ class CustomCPO(dbus.DBusIntrospectionObject):
451+ pass
452+
453+ type_name = dbus.get_type_name(CustomEmulatorBase)
454+ self.assertThat(type_name, Equals('ProxyBase'))
455+
456+ def test_get_type_name_returns_custom_node_name(self):
457+ class CustomCPO(dbus.DBusIntrospectionObject):
458+ @classmethod
459+ def get_type_query_name(cls):
460+ return 'TestingCPO'
461+ type_name = dbus.get_type_name(CustomCPO)
462+ self.assertThat(type_name, Equals('TestingCPO'))
463+
464+ def test_get_type_name_returns_classname_of_non_proxybase_classes(self):
465+ class Foo(object):
466+ pass
467+ self.assertEqual('Foo', dbus.get_type_name(Foo))
468
469=== modified file 'autopilot/tests/unit/test_test_fixtures.py'
470--- autopilot/tests/unit/test_test_fixtures.py 2014-10-28 03:50:36 +0000
471+++ autopilot/tests/unit/test_test_fixtures.py 2015-09-01 23:45:04 +0000
472@@ -229,7 +229,7 @@
473 original_tz = os.environ.get('TZ', None)
474 token = self.getUniqueString()
475
476- fixture = self.useFixture(Timezone(token))
477- fixture.cleanUp()
478+ with Timezone(token):
479+ pass # Trigger cleanup
480
481 self.assertEqual(os.environ.get('TZ', None), original_tz)
482
483=== modified file 'bin/autopilot3-sandbox-run'
484--- bin/autopilot3-sandbox-run 2014-05-15 06:18:19 +0000
485+++ bin/autopilot3-sandbox-run 2015-09-01 23:45:04 +0000
486@@ -3,11 +3,11 @@
487 #
488 # Runner to execute autopilot locally
489 #
490-# This scripts run autopilot in a "fake" X server, either headless with xvfb
491-# or nested with Xephyr
492+# This scripts run autopilot in a "fake" X server, and optionally a
493+# window manager with either headless with xvfb or nested with Xephyr
494 #
495
496-# Copyright (C) 2013 Canonical
497+# Copyright (C) 2013-2015 Canonical
498 #
499 # Authors: Jean-Baptiste Lallement <jean-baptiste.lallement@canonical.com>
500 #
501@@ -38,7 +38,9 @@
502
503 SERVERNUM=5
504 SCREEN="1024x768x24"
505-
506+USEWM=0
507+WINDOWMANAGER="ratpoison"
508+WINDOWMANAGER_CMD="$(which $WINDOWMANAGER||true)"
509 DBUS_SESSION_BUS_PID=""
510 X_PID=""
511
512@@ -48,17 +50,18 @@
513 Usage: $(basename $0) [OPTIONS...] TEST [TEST...]
514 Runs autopilot tests in a 'fake' Xserver with Xvfb or Xephyr. autopilot runs
515 in Xvfb by default.
516-
517+
518 TEST: autopilot tests to run
519
520 Options:
521- -h, --help This help
522- -d, --debug Enable debug mode
523- -a, --autopilot ARG Pass arguments ARG to 'autopilot run'
524- -X, --xephyr Run in nested mode with Xephyr
525- -s, --screen WxHxD Sets screen width, height, and depth to W, H, and D
526- respectively (default: $SCREEN)
527-
528+ -h, --help This help
529+ -d, --debug Enable debug mode
530+ -a, --autopilot ARG Pass arguments ARG to 'autopilot run'
531+ -X, --xephyr Run in nested mode with Xephyr
532+ -s, --screen WxHxD Sets screen width, height, and depth to W, H, and D
533+ respectively (default: $SCREEN)
534+ -w, --windowmanager WM Start a window manager WM before executing tests
535+ (suggested: $WINDOWMANAGER)
536 EOF
537 RC=1
538 exit
539@@ -117,8 +120,8 @@
540
541 trap on_exit EXIT INT QUIT ABRT PIPE TERM
542
543-SHORTOPTS="hda:s:X"
544-LONGOPTS="help,debug,autopilot:,screen:,xephyr"
545+SHORTOPTS="hda:s:Xw:"
546+LONGOPTS="help,debug,autopilot:,screen:,xephyr,windowmanager:"
547
548 TEMP=$(getopt -o $SHORTOPTS --long $LONGOPTS -- "$@")
549 eval set -- "$TEMP"
550@@ -138,6 +141,14 @@
551 -s|-screen)
552 SCREEN=$2
553 shift 2;;
554+ -w|--windowmanager)
555+ USEWM=1
556+ WINDOWMANAGER=$2
557+ WINDOWMANAGER_CMD="$(which $WINDOWMANAGER||true)"
558+ [ ! -x "$WINDOWMANAGER_CMD" ] && \
559+ echo "E: $WINDOWMANAGER Executable not found." &&\
560+ RC=1 && exit 1
561+ shift 2;;
562 -X|--xephyr)
563 XEPHYR=1
564 [ ! -x "$XEPHYR_CMD" ] && \
565@@ -154,7 +165,7 @@
566 if [ $XEPHYR -eq 0 -a ! -x "$XVFB_CMD" ]; then
567 echo "E: Xvfb executable not found. Please install xvfb"
568 RC=1
569- exit
570+ exit
571 fi
572
573 TESTLIST="$@"
574@@ -171,6 +182,10 @@
575
576 export XAUTHORITY=/dev/null
577 wait_for_x $SERVERNUM
578+if [ "$USEWM" -eq 1 ]; then
579+ echo "I: Starting window manager: $WINDOWMANAGER_CMD"
580+ dbus-launch --exit-with-session $WINDOWMANAGER_CMD &
581+fi
582 echo "I: Starting autopilot"
583 dbus-launch --exit-with-session python3 -m autopilot.run run $AP_OPT $TESTLIST || RC=$?
584 echo "I: autopilot tests done"
585
586=== modified file 'debian/control'
587--- debian/control 2015-03-18 17:24:48 +0000
588+++ debian/control 2015-09-01 23:45:04 +0000
589@@ -68,6 +68,7 @@
590 python3-evdev,
591 python3-xlib (>=0.14+20091101-1ubuntu3),
592 recordmydesktop,
593+ ubuntu-keyboard-data,
594 Breaks: libautopilot-gtk (<< 1.4),
595 libautopilot-qt (<< 1.4),
596 Description: Utility to write and run integration tests easily (Python 3)
597
598=== modified file 'debian/rules'
599--- debian/rules 2015-05-22 16:53:58 +0000
600+++ debian/rules 2015-09-01 23:45:04 +0000
601@@ -12,7 +12,7 @@
602 -dh_sphinxdoc
603
604 override_dh_auto_build:
605- python3 -m flake8.run .
606+ python3 -m flake8.run --ignore=E731,E226,W503 .
607 dh_auto_build
608 python3 setup.py build_sphinx -b html
609 python3 setup.py build_sphinx -b json
610
611=== modified file 'setup.py'
612--- setup.py 2014-05-15 05:59:11 +0000
613+++ setup.py 2015-09-01 23:45:04 +0000
614@@ -17,12 +17,11 @@
615 # You should have received a copy of the GNU General Public License
616 # along with this program. If not, see <http://www.gnu.org/licenses/>.
617 #
618+from setuptools import find_packages, setup, Extension
619
620 import sys
621 assert sys.version_info >= (3,), 'Python 3 is required'
622
623-from setuptools import find_packages, setup, Extension
624-
625
626 VERSION = '1.5.0'
627

Subscribers

People subscribed via source and target branches