Merge lp:~veebers/autopilot/custom_emulator_lp-1191164 into lp:autopilot

Proposed by Christopher Lee
Status: Merged
Approved by: Thomi Richards
Approved revision: 249
Merged at revision: 247
Proposed branch: lp:~veebers/autopilot/custom_emulator_lp-1191164
Merge into: lp:autopilot
Diff against target: 41 lines (+16/-0)
2 files modified
autopilot/introspection/dbus.py (+2/-0)
autopilot/tests/functional/test_introspection_features.py (+14/-0)
To merge this branch: bzr merge lp:~veebers/autopilot/custom_emulator_lp-1191164
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Thomi Richards (community) Approve
Leo Arias (community) code review Approve
Review via email: mp+170480@code.launchpad.net

Commit message

Make sure the Custom emulators _Backend is set when creating an introspection object.

Description of the change

CustomEmulator cls._Backend wasn't being set. Make sure it's set when creating an introspection object.

To post a comment you must log in.
Revision history for this message
Christopher Lee (veebers) wrote :

I can't help but feel that this is a bandaid and that I'm missing a more fundamental fix.

Revision history for this message
Leo Arias (elopio) wrote :

<elopio> veebers: I think it will work.
<elopio> when I read this code in autopilot I got the feeling that a lot is black magic, not really clear.
<elopio> but I don't have an alternate solution. If the test added passes, I'm happy.
<veebers> elopio: it works at the moment (i.e. all the autopilot tests pass, I'm just going to run the Unity tests) but I'm not sure that it is as intended
<veebers> elopio: aye, It's not the easiest to read (with metaclasses et. al). If all the tests pass I'll get it merged in. I'll hit up thomi once he gets back to check if there is a better option too
<elopio> veebers: +1
<elopio> let me leave an approve comment.

review: Approve (code review)
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'autopilot/introspection/dbus.py'
--- autopilot/introspection/dbus.py 2013-05-23 23:09:52 +0000
+++ autopilot/introspection/dbus.py 2013-06-20 21:26:23 +0000
@@ -475,6 +475,8 @@
475 name = get_classname_from_path(path)475 name = get_classname_from_path(path)
476 try:476 try:
477 class_type = _object_registry[cls._id][name]477 class_type = _object_registry[cls._id][name]
478 if class_type._Backend is None:
479 class_type._Backend = cls._Backend
478 except KeyError:480 except KeyError:
479 logger.warning("Generating introspection instance for type '%s' based on generic class.", name)481 logger.warning("Generating introspection instance for type '%s' based on generic class.", name)
480 # override the _id attr from cls, since we don't want generated types482 # override the _id attr from cls, since we don't want generated types
481483
=== modified file 'autopilot/tests/functional/test_introspection_features.py'
--- autopilot/tests/functional/test_introspection_features.py 2013-05-23 05:05:58 +0000
+++ autopilot/tests/functional/test_introspection_features.py 2013-06-20 21:26:23 +0000
@@ -22,6 +22,7 @@
22from tempfile import mktemp22from tempfile import mktemp
23from testtools.matchers import Equals23from testtools.matchers import Equals
2424
25from autopilot.matchers import Eventually
25from autopilot.testcase import AutopilotTestCase26from autopilot.testcase import AutopilotTestCase
26from autopilot.introspection.dbus import CustomEmulatorBase27from autopilot.introspection.dbus import CustomEmulatorBase
2728
@@ -73,3 +74,16 @@
7374
74 self.assertThat(type(test_widget), Equals(MouseTestWidget))75 self.assertThat(type(test_widget), Equals(MouseTestWidget))
7576
77 def test_can_access_custom_emulator_properties(self):
78 """Must be able to access properties of a custom emulator."""
79
80 class EmulatorBase(CustomEmulatorBase):
81 pass
82
83 class MouseTestWidget(EmulatorBase):
84 pass
85
86 app = self.start_mock_app(EmulatorBase)
87 test_widget = app.select_single(MouseTestWidget)
88
89 self.assertThat(test_widget.visible, Eventually(Equals(True)))

Subscribers

People subscribed via source and target branches