Merge lp:~chris.gagnon/autopilot/troubleshooting-url into lp:~autopilot/autopilot/temp-dev
- troubleshooting-url
- Merge into temp-dev
Status: | Merged |
---|---|
Approved by: | Christopher Lee |
Approved revision: | 497 |
Merged at revision: | 520 |
Proposed branch: | lp:~chris.gagnon/autopilot/troubleshooting-url |
Merge into: | lp:~autopilot/autopilot/temp-dev |
Diff against target: |
197 lines (+54/-36) 5 files modified
autopilot/exceptions.py (+13/-12) autopilot/tests/unit/test_exceptions.py (+26/-20) autopilot/tests/unit/test_introspection_dbus.py (+3/-1) autopilot/tests/unit/test_types.py (+4/-3) debian/changelog (+8/-0) |
To merge this branch: | bzr merge lp:~chris.gagnon/autopilot/troubleshooting-url |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Christopher Lee (community) | Approve | ||
Review via email: mp+221512@code.launchpad.net |
Commit message
link to url troubleshooting guide when state not found error is raise
Description of the change
- 492. By Chris Gagnon
-
add period back, from accidental deletion
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:492
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Christopher Lee (veebers) wrote : | # |
(diffline 74) Seems annoying to use a setUp here just to get a message used later on. Perhaps you can make the test a module level private string and just import that?
Also could you create a test that specifically tests that the exception message includes the expected text?
- 493. By Chris Gagnon
-
make a private string for the url troubleshooting guide so it can be reused in tests, add a test to make sure it ends with the expected url guide text, don't use setup for url txt.
- 494. By Chris Gagnon
-
remove self
- 495. By Chris Gagnon
-
remove commented out print
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:493
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:495
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 496. By Chris Gagnon
-
fixup un-needed self.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:496
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Christopher Lee (veebers) wrote : | # |
I know I said module level var, but on reflection it should be a class variable on StateNotFound (I had in my mind that it would be useful in other places/exceptions, but YAGNI) sorry about that.
In the process could you also rename it from "_url_message_link" to something like "_troubleshoot_
The language in the message needs to be more friendly (i.e. 'fix your broken tests') perhaps something along the lines of:
"See <url> for tips on minimising the occurrence of this failure"
- 497. By Chris Gagnon
-
fix flipflop in review, make message more polite.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:497
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'autopilot/exceptions.py' |
2 | --- autopilot/exceptions.py 2014-05-21 07:39:59 +0000 |
3 | +++ autopilot/exceptions.py 2014-06-04 22:03:19 +0000 |
4 | @@ -26,11 +26,8 @@ |
5 | |
6 | """ |
7 | |
8 | -import six |
9 | - |
10 | |
11 | class BackendException(RuntimeError): |
12 | - |
13 | """An error occured while trying to initialise an autopilot backend.""" |
14 | |
15 | def __init__(self, original_exception): |
16 | @@ -63,7 +60,6 @@ |
17 | application. |
18 | |
19 | """ |
20 | - |
21 | def __init__(self, class_name=None, **filters): |
22 | """Construct a StateNotFoundError. |
23 | |
24 | @@ -71,13 +67,14 @@ |
25 | are specified. |
26 | |
27 | """ |
28 | + |
29 | if class_name is None and not filters: |
30 | raise ValueError("Must specify either class name or filters.") |
31 | |
32 | if class_name is None: |
33 | self._message = \ |
34 | u"Object not found with properties {}.".format( |
35 | - repr(filters) |
36 | + repr(filters), |
37 | ) |
38 | elif not filters: |
39 | self._message = u"Object not found with name '{}'.".format( |
40 | @@ -90,14 +87,18 @@ |
41 | repr(filters) |
42 | ) |
43 | |
44 | + _troubleshoot_url_message = ( |
45 | + 'Tips on minimizing the occurrence of this failure' |
46 | + 'are available here: ' |
47 | + 'http://developer.ubuntu.com/api/devel/ubuntu-14.10/python/' |
48 | + 'autopilot/faq/troubleshooting.html' |
49 | + ) |
50 | + |
51 | def __str__(self): |
52 | - if six.PY3: |
53 | - return self._message |
54 | - else: |
55 | - return self._message.encode('utf8') |
56 | - |
57 | - def __unicode__(self): |
58 | - return self._message |
59 | + return '{}\n\n{}'.format( |
60 | + self._message, |
61 | + self._troubleshoot_url_message |
62 | + ) |
63 | |
64 | |
65 | class InvalidXPathQuery(ValueError): |
66 | |
67 | === modified file 'autopilot/tests/unit/test_exceptions.py' |
68 | --- autopilot/tests/unit/test_exceptions.py 2014-04-15 02:32:16 +0000 |
69 | +++ autopilot/tests/unit/test_exceptions.py 2014-06-04 22:03:19 +0000 |
70 | @@ -17,9 +17,8 @@ |
71 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
72 | # |
73 | |
74 | -import six |
75 | from testtools import TestCase |
76 | -from testtools.matchers import raises, Equals |
77 | +from testtools.matchers import raises, EndsWith, Equals |
78 | |
79 | from autopilot.exceptions import StateNotFoundError |
80 | |
81 | @@ -41,26 +40,23 @@ |
82 | err = StateNotFoundError("MyClass") |
83 | self.assertThat( |
84 | str(err), |
85 | - Equals("Object not found with name 'MyClass'.") |
86 | + Equals("Object not found with name 'MyClass'.\n\n{}".format( |
87 | + StateNotFoundError._troubleshoot_url_message |
88 | + )) |
89 | ) |
90 | - if not six.PY3: |
91 | - self.assertThat( |
92 | - unicode(err), |
93 | - Equals(u"Object not found with name 'MyClass'.") |
94 | - ) |
95 | |
96 | def test_can_be_constructed_with_filters_only(self): |
97 | """Must be able to construct exception with filters only.""" |
98 | err = StateNotFoundError(foo="bar") |
99 | self.assertThat( |
100 | str(err), |
101 | - Equals("Object not found with properties {'foo': 'bar'}.") |
102 | + Equals( |
103 | + "Object not found with properties {}." |
104 | + "\n\n{}".format( |
105 | + "{'foo': 'bar'}", |
106 | + StateNotFoundError._troubleshoot_url_message |
107 | + )) |
108 | ) |
109 | - if not six.PY3: |
110 | - self.assertThat( |
111 | - unicode(err), |
112 | - Equals(u"Object not found with properties {'foo': 'bar'}.") |
113 | - ) |
114 | |
115 | def test_can_be_constructed_with_class_name_and_filters(self): |
116 | """Must be able to construct with both class name and filters.""" |
117 | @@ -68,11 +64,21 @@ |
118 | self.assertThat( |
119 | str(err), |
120 | Equals("Object not found with name 'MyClass'" |
121 | - " and properties {'foo': 'bar'}.") |
122 | + " and properties {}.\n\n{}".format( |
123 | + "{'foo': 'bar'}", |
124 | + StateNotFoundError._troubleshoot_url_message |
125 | + )) |
126 | ) |
127 | - if not six.PY3: |
128 | - self.assertThat( |
129 | - unicode(err), |
130 | - Equals(u"Object not found with name 'MyClass'" |
131 | - " and properties {'foo': 'bar'}.") |
132 | + |
133 | + def test_StateNotFoundError_endswith_troubleshoot_url_message_text(self): |
134 | + """The assertion raised must end with a link to troubleshooting url.""" |
135 | + err = StateNotFoundError('MyClass', foo="bar") |
136 | + self.assertThat( |
137 | + str(err), |
138 | + EndsWith( |
139 | + 'Tips on minimizing the occurrence of this failure' |
140 | + 'are available here: ' |
141 | + 'http://developer.ubuntu.com/api/devel/ubuntu-14.10/python/' |
142 | + 'autopilot/faq/troubleshooting.html' |
143 | ) |
144 | + ) |
145 | |
146 | === modified file 'autopilot/tests/unit/test_introspection_dbus.py' |
147 | --- autopilot/tests/unit/test_introspection_dbus.py 2014-05-20 08:53:21 +0000 |
148 | +++ autopilot/tests/unit/test_introspection_dbus.py 2014-06-04 22:03:19 +0000 |
149 | @@ -171,7 +171,9 @@ |
150 | path: '/some/path' |
151 | text: 'Hello' |
152 | Error: Object not found with name 'child'. |
153 | - """)) |
154 | + |
155 | + {} |
156 | + """.format(StateNotFoundError._troubleshoot_url_message))) |
157 | |
158 | def test_print_tree_fileobj(self): |
159 | """print_tree with file object output""" |
160 | |
161 | === modified file 'autopilot/tests/unit/test_types.py' |
162 | --- autopilot/tests/unit/test_types.py 2014-05-20 08:53:21 +0000 |
163 | +++ autopilot/tests/unit/test_types.py 2014-06-04 22:03:19 +0000 |
164 | @@ -19,13 +19,14 @@ |
165 | |
166 | from __future__ import absolute_import |
167 | |
168 | +import dbus |
169 | +import six |
170 | + |
171 | from datetime import datetime, time |
172 | -from unittest.mock import patch, Mock |
173 | -import six |
174 | from testscenarios import TestWithScenarios |
175 | from testtools import TestCase |
176 | from testtools.matchers import Equals, IsInstance, NotEquals, raises |
177 | -import dbus |
178 | +from unittest.mock import patch, Mock |
179 | |
180 | from autopilot.introspection.types import ( |
181 | Color, |
182 | |
183 | === modified file 'debian/changelog' |
184 | --- debian/changelog 2014-05-09 00:48:14 +0000 |
185 | +++ debian/changelog 2014-06-04 22:03:19 +0000 |
186 | @@ -1,3 +1,11 @@ |
187 | +autopilot (1.5.0+14.10.20140526.1-0ubuntu1) utopic; urgency=low |
188 | + |
189 | + [ Tarmac ] |
190 | + * Add fixtures for launching applications. (LP: #1322033, #1291531, |
191 | + #1320149) |
192 | + |
193 | + -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Mon, 26 May 2014 12:50:10 +0000 |
194 | + |
195 | autopilot (1.5.0+14.10.20140509-0ubuntu1) utopic; urgency=low |
196 | |
197 | [ Thomi Richards ] |
PASSED: Continuous integration, rev:491 jenkins. qa.ubuntu. com/job/ autopilot- autopilot- temp-dev- ci/135/ jenkins. qa.ubuntu. com/job/ autopilot- autopilot- temp-dev- utopic- amd64-ci/ 96 jenkins. qa.ubuntu. com/job/ autopilot- autopilot- temp-dev- utopic- amd64-ci/ 96/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ autopilot- autopilot- temp-dev- utopic- armhf-ci/ 96 jenkins. qa.ubuntu. com/job/ autopilot- autopilot- temp-dev- utopic- armhf-ci/ 96/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ autopilot- autopilot- temp-dev- utopic- i386-ci/ 96 jenkins. qa.ubuntu. com/job/ autopilot- autopilot- temp-dev- utopic- i386-ci/ 96/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ autopilot- testrunner- otto-utopic- autopilot/ 209 jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- mako/6769/ console s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 7932
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/autopilot- autopilot- temp-dev- ci/135/ rebuild
http://