Merge ~cjwatson/launchpad:py3-answers-exception-modules into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: ce89f4e6ee41700062dcb6bae7ab90eb6f14a8ee
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:py3-answers-exception-modules
Merge into: launchpad:master
Diff against target: 543 lines (+88/-44)
17 files modified
lib/lp/answers/doc/faq.txt (+4/-2)
lib/lp/answers/doc/faqtarget.txt (+2/-1)
lib/lp/answers/doc/questiontarget.txt (+8/-4)
lib/lp/answers/doc/workflow.txt (+10/-5)
lib/lp/answers/stories/distribution-package-answer-contact.txt (+2/-1)
lib/lp/answers/stories/faq-add.txt (+4/-2)
lib/lp/answers/stories/faq-browse-and-search.txt (+4/-2)
lib/lp/answers/stories/faq-edit.txt (+8/-4)
lib/lp/answers/stories/project-add-question.txt (+2/-1)
lib/lp/answers/stories/question-add.txt (+2/-1)
lib/lp/answers/stories/question-browse-and-search.txt (+14/-7)
lib/lp/answers/stories/question-edit.txt (+2/-1)
lib/lp/answers/stories/question-overview.txt (+8/-4)
lib/lp/answers/stories/question-reject-and-change-status.txt (+6/-3)
lib/lp/answers/stories/this-is-a-faq.txt (+6/-3)
lib/lp/testing/pages.py (+1/-3)
lib/lp/testing/systemdocs.py (+5/-0)
Reviewer Review Type Date Requested Status
Thiago F. Pappacena (community) Approve
Review via email: mp+396285@code.launchpad.net

Commit message

lp.answers: Use IGNORE_EXCEPTION_MODULE_IN_PYTHON2

Description of the change

This allows doctests that test tracebacks to work on both Python 2 and 3. See https://pypi.org/project/zope.testing/#regular-expression-pattern-normalizing-output-checker for the semantics of this custom option flag.

There are lots of cases like this all over the codebase, but this branch only tackles lp.answers for now since the full patch for everything ends up being on the order of 10000 lines; if this looks OK then I expect to self-approve most of the rest to save on reviewer bandwidth, since it all follows pretty much the same pattern.

To post a comment you must log in.
Revision history for this message
Thiago F. Pappacena (pappacena) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/answers/doc/faq.txt b/lib/lp/answers/doc/faq.txt
2index 5c8c479..594242d 100644
3--- a/lib/lp/answers/doc/faq.txt
4+++ b/lib/lp/answers/doc/faq.txt
5@@ -320,17 +320,19 @@ That change is also considered an answer:
6 It is not possible to modify the faq attribute directly:
7
8 >>> fnord_question.faq = None
9+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
10 Traceback (most recent call last):
11 ...
12- ForbiddenAttribute: ...
13+ zope.security.interfaces.ForbiddenAttribute: ...
14
15 And it is not allowed to call linkFAQ() when the FAQ is already linked:
16
17 >>> message = fnord_question.linkFAQ(
18 ... no_priv, firefox_faq, 'See the FAQ.')
19+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
20 Traceback (most recent call last):
21 ...
22- FAQTargetError: Cannot call linkFAQ() with already linked FAQ.
23+ lp.answers.errors.FAQTargetError: Cannot call linkFAQ() with already linked FAQ.
24
25 A FAQ can be linked to a 'solved' question, in which case, the status is
26 not changed.
27diff --git a/lib/lp/answers/doc/faqtarget.txt b/lib/lp/answers/doc/faqtarget.txt
28index 145cb91..0518e70 100644
29--- a/lib/lp/answers/doc/faqtarget.txt
30+++ b/lib/lp/answers/doc/faqtarget.txt
31@@ -38,9 +38,10 @@ the target.
32
33 >>> no_priv = getUtility(ILaunchBag).user
34 >>> target.newFAQ(no_priv, 'Title', 'Summary', content='Content')
35+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
36 Traceback (most recent call last):
37 ...
38- Unauthorized: ...
39+ zope.security.interfaces.Unauthorized: ...
40
41 In practice, this means that only the project's owner (aka maintainer)
42 or one of its answer contacts is authorized to create a new FAQ.
43diff --git a/lib/lp/answers/doc/questiontarget.txt b/lib/lp/answers/doc/questiontarget.txt
44index a2879b9..99731b0 100644
45--- a/lib/lp/answers/doc/questiontarget.txt
46+++ b/lib/lp/answers/doc/questiontarget.txt
47@@ -89,9 +89,10 @@ Anonymous users cannot use newQuestion().
48 >>> login(ANONYMOUS)
49 >>> question = target.newQuestion(
50 ... sample_person, 'This will fail', 'Failed?')
51+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
52 Traceback (most recent call last):
53 ...
54- Unauthorized...
55+ zope.security.interfaces.Unauthorized: ...
56
57
58 Retrieving questions
59@@ -387,9 +388,10 @@ is only available to registered users.
60
61 >>> name18 = getUtility(IPersonSet).getByName('name18')
62 >>> target.addAnswerContact(name18, name18)
63+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
64 Traceback (most recent call last):
65 ...
66- Unauthorized...
67+ zope.security.interfaces.Unauthorized: ...
68
69 This method returns True when the contact was added the list and False when it
70 was already on the list.
71@@ -417,9 +419,10 @@ languages.
72 >>> len(sample_person.languages)
73 0
74 >>> target.addAnswerContact(sample_person, sample_person)
75+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
76 Traceback (most recent call last):
77 ...
78- AddAnswerContactError: An answer contact must speak a language...
79+ lp.answers.errors.AddAnswerContactError: An answer contact must speak a language...
80
81 Answer contacts can be removed by using the removeAnswerContact() method.
82 Like its counterpart, it returns True when the answer contact was removed and
83@@ -438,9 +441,10 @@ Only registered users can remove an answer contact.
84
85 >>> login(ANONYMOUS)
86 >>> target.removeAnswerContact(name18, name18)
87+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
88 Traceback (most recent call last):
89 ...
90- Unauthorized...
91+ zope.security.interfaces.Unauthorized: ...
92
93
94 Supported languages
95diff --git a/lib/lp/answers/doc/workflow.txt b/lib/lp/answers/doc/workflow.txt
96index 4d2116e..c9d3c74 100644
97--- a/lib/lp/answers/doc/workflow.txt
98+++ b/lib/lp/answers/doc/workflow.txt
99@@ -426,9 +426,10 @@ As a Launchpad administrator, so can Stub.
100 >>> login(marilize.preferredemail.email)
101 >>> spam_question.reject(
102 ... marilize, "We don't send free CDs any more.")
103+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
104 Traceback (most recent call last):
105 ...
106- Unauthorized: ...
107+ zope.security.interfaces.Unauthorized: ...
108
109 When rejecting a question, a comment explaining the reason is given.
110
111@@ -484,9 +485,10 @@ It is not possible to change the status attribute directly.
112 >>> login('foo.bar@canonical.com')
113 >>> question = ubuntu.newQuestion(**new_question_args)
114 >>> question.status = QuestionStatus.INVALID
115+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
116 Traceback (most recent call last):
117 ...
118- ForbiddenAttribute...
119+ zope.security.interfaces.ForbiddenAttribute: ...
120
121 A user having launchpad.Admin permission on the question can set the question
122 status to an arbitrary value, by giving the new status and a comment
123@@ -542,9 +544,10 @@ permission, an Unauthorized exception is thrown.
124
125 >>> login('test@canonical.com')
126 >>> question.setStatus(sample_person, QuestionStatus.EXPIRED, 'Expire.')
127+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
128 Traceback (most recent call last):
129 ...
130- Unauthorized...
131+ zope.security.interfaces.Unauthorized: ...
132
133
134 Adding Comments Without Changing the Status
135@@ -590,9 +593,10 @@ Users without launchpad.Moderator privileges cannot set the assignee.
136
137 >>> login('no-priv@canonical.com')
138 >>> question.assignee = sample_person
139+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
140 Traceback (most recent call last):
141 ...
142- Unauthorized: (<lp.answers.model.question.Question ...>, 'assignee', 'launchpad.Append')
143+ zope.security.interfaces.Unauthorized: (<lp.answers.model.question.Question ...>, 'assignee', 'launchpad.Append')
144
145
146 Events
147@@ -763,6 +767,7 @@ method.
148
149 >>> login(stub.preferredemail.email)
150 >>> question.setStatus(stub, QuestionStatus.OPEN, reject_message)
151+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
152 Traceback (most recent call last):
153 ...
154- NotMessageOwnerError...
155+ lp.answers.errors.NotMessageOwnerError: ...
156diff --git a/lib/lp/answers/stories/distribution-package-answer-contact.txt b/lib/lp/answers/stories/distribution-package-answer-contact.txt
157index 45a8afb..048e495 100644
158--- a/lib/lp/answers/stories/distribution-package-answer-contact.txt
159+++ b/lib/lp/answers/stories/distribution-package-answer-contact.txt
160@@ -36,9 +36,10 @@ To register themselves as answer contact, the user clicks on the
161 'Set answer contact' link. They need to login to access that function.
162
163 >>> anon_browser.getLink('Set answer contact').click()
164+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
165 Traceback (most recent call last):
166 ...
167- Unauthorized: ...
168+ zope.security.interfaces.Unauthorized: ...
169
170 >>> browser.addHeader('Authorization', 'Basic test@canonical.com:test')
171 >>> browser.open(
172diff --git a/lib/lp/answers/stories/faq-add.txt b/lib/lp/answers/stories/faq-add.txt
173index ca391a0..effa2fb 100644
174--- a/lib/lp/answers/stories/faq-add.txt
175+++ b/lib/lp/answers/stories/faq-add.txt
176@@ -10,15 +10,17 @@ the project owner, therefore they cannot create a new FAQ.
177 >>> user_browser.getLink('All FAQs').click()
178
179 >>> user_browser.getLink('Create a new FAQ')
180+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
181 Traceback (most recent call last):
182 ...
183- LinkNotFoundError
184+ zope.testbrowser.browser.LinkNotFoundError
185
186 >>> user_browser.open(
187 ... 'http://answers.launchpad.test/firefox/+createfaq')
188+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
189 Traceback (most recent call last):
190 ...
191- Unauthorized: ...
192+ zope.security.interfaces.Unauthorized: ...
193
194 Sample Person does have that ability to create a FAQ because they are the
195 project owner. They are looking for a FAQ about RSS, but they do not find
196diff --git a/lib/lp/answers/stories/faq-browse-and-search.txt b/lib/lp/answers/stories/faq-browse-and-search.txt
197index 8826620..2d3555f 100644
198--- a/lib/lp/answers/stories/faq-browse-and-search.txt
199+++ b/lib/lp/answers/stories/faq-browse-and-search.txt
200@@ -178,11 +178,13 @@ distribution FAQs.
201 Asking for a non-existent FAQ or an invalid ID will raise a 404 error.
202
203 >>> anon_browser.open('http://answers.launchpad.test/ubuntu/+faq/171717')
204+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
205 Traceback (most recent call last):
206 ...
207- NotFound: ...
208+ zope.publisher.interfaces.NotFound: ...
209
210 >>> anon_browser.open('http://answers.launchpad.test/ubuntu/+faq/bad')
211+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
212 Traceback (most recent call last):
213 ...
214- NotFound: ...
215+ zope.publisher.interfaces.NotFound: ...
216diff --git a/lib/lp/answers/stories/faq-edit.txt b/lib/lp/answers/stories/faq-edit.txt
217index 820efd7..dc5969c 100644
218--- a/lib/lp/answers/stories/faq-edit.txt
219+++ b/lib/lp/answers/stories/faq-edit.txt
220@@ -13,28 +13,32 @@ appear for the anonymous user nor No Privileges Person:
221 FAQ #7 : Questions : Mozilla Firefox
222
223 >>> anon_browser.getLink('Edit FAQ')
224+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
225 Traceback (most recent call last):
226 ...
227- LinkNotFoundError
228+ zope.testbrowser.browser.LinkNotFoundError
229
230 >>> user_browser.open('http://answers.launchpad.test/firefox/+faq/7')
231 >>> user_browser.getLink('Edit FAQ')
232+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
233 Traceback (most recent call last):
234 ...
235- LinkNotFoundError
236+ zope.testbrowser.browser.LinkNotFoundError
237
238 Even trying to access the link directly will fail:
239
240 >>> anon_browser.open(
241 ... 'http://answers.launchpad.test/firefox/+faq/7/+edit')
242+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
243 Traceback (most recent call last):
244 ...
245- Unauthorized: ...
246+ zope.security.interfaces.Unauthorized: ...
247 >>> user_browser.open(
248 ... 'http://answers.launchpad.test/firefox/+faq/7/+edit')
249+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
250 Traceback (most recent call last):
251 ...
252- Unauthorized: ...
253+ zope.security.interfaces.Unauthorized: ...
254
255 The link is accessible to Sample Person who is the owner of the Firefox
256 project:
257diff --git a/lib/lp/answers/stories/project-add-question.txt b/lib/lp/answers/stories/project-add-question.txt
258index ecd8271..dba5767 100644
259--- a/lib/lp/answers/stories/project-add-question.txt
260+++ b/lib/lp/answers/stories/project-add-question.txt
261@@ -26,9 +26,10 @@ Project in this case.
262
263 >>> anon_browser.open('http://answers.launchpad.test/mozilla')
264 >>> anon_browser.getLink('Ask a question').click()
265+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
266 Traceback (most recent call last):
267 ...
268- Unauthorized...
269+ zope.security.interfaces.Unauthorized: ...
270
271 >>> user_browser.open('http://answers.launchpad.test/mozilla')
272 >>> user_browser.getLink('Ask a question').click()
273diff --git a/lib/lp/answers/stories/question-add.txt b/lib/lp/answers/stories/question-add.txt
274index b8cfea0..1b7ec27 100644
275--- a/lib/lp/answers/stories/question-add.txt
276+++ b/lib/lp/answers/stories/question-add.txt
277@@ -18,9 +18,10 @@ The user sees an involvement link to ask a question.
278 Asking a new question requires logging in:
279
280 >>> browser.getLink('Ask a question').click()
281+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
282 Traceback (most recent call last):
283 ...
284- Unauthorized...
285+ zope.security.interfaces.Unauthorized: ...
286 >>> user_browser.open('http://answers.launchpad.test/ubuntu/')
287 >>> user_browser.getLink('Ask a question').click()
288 >>> print(user_browser.title)
289diff --git a/lib/lp/answers/stories/question-browse-and-search.txt b/lib/lp/answers/stories/question-browse-and-search.txt
290index 6d587ee..0abf0ed 100644
291--- a/lib/lp/answers/stories/question-browse-and-search.txt
292+++ b/lib/lp/answers/stories/question-browse-and-search.txt
293@@ -41,9 +41,10 @@ For projects that don't have products, the Answers facet is disabled.
294
295 >>> browser.open('http://launchpad.test/aaa')
296 >>> browser.getLink('Answers')
297+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
298 Traceback (most recent call last):
299 ...
300- LinkNotFoundError
301+ zope.testbrowser.browser.LinkNotFoundError
302
303 == Browsing Questions ==
304
305@@ -83,15 +84,17 @@ out.
306 >>> 'Next' in browser.contents
307 True
308 >>> browser.getLink('Next')
309+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
310 Traceback (most recent call last):
311 ..
312- LinkNotFoundError...
313+ zope.testbrowser.browser.LinkNotFoundError
314 >>> 'Last' in browser.contents
315 True
316 >>> browser.getLink('Last')
317+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
318 Traceback (most recent call last):
319 ..
320- LinkNotFoundError...
321+ zope.testbrowser.browser.LinkNotFoundError
322
323 He decides to go the first page. He remembered one question title that
324 might have been remotely related to his problem.
325@@ -104,15 +107,17 @@ greyed out:
326 >>> 'Previous' in browser.contents
327 True
328 >>> browser.getLink('Previous')
329+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
330 Traceback (most recent call last):
331 ..
332- LinkNotFoundError...
333+ zope.testbrowser.browser.LinkNotFoundError
334 >>> 'First' in browser.contents
335 True
336 >>> browser.getLink('First')
337+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
338 Traceback (most recent call last):
339 ..
340- LinkNotFoundError...
341+ zope.testbrowser.browser.LinkNotFoundError
342
343 When he passes the mouse over the question's row, the beginning of the
344 description appears in a small pop-up:
345@@ -370,9 +375,10 @@ They need to login to access that page:
346 ... 'http://launchpad.test/ubuntu/+source/mozilla-firefox/'
347 ... '+questions')
348 >>> anon_browser.getLink('My questions').click()
349+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
350 Traceback (most recent call last):
351 ...
352- Unauthorized...
353+ zope.security.interfaces.Unauthorized: ...
354
355 >>> sample_person_browser = setupBrowser(
356 ... auth='Basic test@canonical.com:test')
357@@ -441,9 +447,10 @@ They need to login to access that page:
358
359 >>> anon_browser.open('http://launchpad.test/distros/ubuntu/+questions')
360 >>> anon_browser.getLink('Need attention').click()
361+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
362 Traceback (most recent call last):
363 ...
364- Unauthorized...
365+ zope.security.interfaces.Unauthorized: ...
366
367 >>> sample_person_browser.open(
368 ... 'http://launchpad.test/distros/ubuntu/+questions')
369diff --git a/lib/lp/answers/stories/question-edit.txt b/lib/lp/answers/stories/question-edit.txt
370index 3f7a2bc..be19a95 100644
371--- a/lib/lp/answers/stories/question-edit.txt
372+++ b/lib/lp/answers/stories/question-edit.txt
373@@ -7,9 +7,10 @@ title and description.
374
375 >>> anon_browser.open('http://launchpad.test/firefox/+question/2')
376 >>> anon_browser.getLink('Edit question').click()
377+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
378 Traceback (most recent call last):
379 ...
380- Unauthorized...
381+ zope.security.interfaces.Unauthorized: ...
382
383 >>> test_browser = setupBrowser(auth='Basic test@canonical.com:test')
384 >>> test_browser.open('http://launchpad.test/firefox/+question/2')
385diff --git a/lib/lp/answers/stories/question-overview.txt b/lib/lp/answers/stories/question-overview.txt
386index 0a22246..8639aa6 100644
387--- a/lib/lp/answers/stories/question-overview.txt
388+++ b/lib/lp/answers/stories/question-overview.txt
389@@ -235,14 +235,16 @@ Asking for a non-existent question or an invalid ID will still raise a
390 404 though:
391
392 >>> browser.open('http://answers.launchpad.test/questions/255')
393+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
394 Traceback (most recent call last):
395 ...
396- NotFound: ...
397+ zope.publisher.interfaces.NotFound: ...
398
399 >>> browser.open('http://answers.launchpad.test/questions/bad_id')
400+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
401 Traceback (most recent call last):
402 ...
403- NotFound: ...
404+ zope.publisher.interfaces.NotFound: ...
405
406 Also If you access a question through the wrong context, you'll be
407 redirected to the question in the proper context. (For example, this is
408@@ -266,14 +268,16 @@ It also works with pages below that URL:
409 But again, an invalid ID still raises a 404:
410
411 >>> browser.open('http://answers.launchpad.test/ubuntu/+question/255')
412+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
413 Traceback (most recent call last):
414 ...
415- NotFound: ...
416+ zope.publisher.interfaces.NotFound: ...
417
418 >>> browser.open(
419 ... 'http://answers.launchpad.test/ubuntu/+question/bad_id')
420+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
421 Traceback (most recent call last):
422 ...
423- NotFound: ...
424+ zope.publisher.interfaces.NotFound: ...
425
426
427diff --git a/lib/lp/answers/stories/question-reject-and-change-status.txt b/lib/lp/answers/stories/question-reject-and-change-status.txt
428index 9b2c22b..44467a4 100644
429--- a/lib/lp/answers/stories/question-reject-and-change-status.txt
430+++ b/lib/lp/answers/stories/question-reject-and-change-status.txt
431@@ -9,18 +9,20 @@ don't have access to that feature.
432
433 >>> user_browser.open('http://launchpad.test/firefox/+question/2')
434 >>> user_browser.getLink('Reject question')
435+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
436 Traceback (most recent call last):
437 ...
438- LinkNotFoundError...
439+ zope.testbrowser.browser.LinkNotFoundError
440
441 Even when trying to access the page directly, they will get an unauthorized
442 error.
443
444 >>> user_browser.open(
445 ... 'http://launchpad.test/firefox/+question/2/+reject')
446+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
447 Traceback (most recent call last):
448 ...
449- Unauthorized: ...
450+ zope.security.interfaces.Unauthorized: ...
451
452 To reject the question, the user clicks on the 'Reject Question' link.
453
454@@ -99,9 +101,10 @@ That action isn't available to a non-privileged user:
455
456 >>> browser.open('http://launchpad.test/firefox/+question/2')
457 >>> browser.getLink('Change status')
458+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
459 Traceback (most recent call last):
460 ...
461- LinkNotFoundError...
462+ zope.testbrowser.browser.LinkNotFoundError
463
464 The change status form is available to an administrator through the
465 'Change status' link.
466diff --git a/lib/lp/answers/stories/this-is-a-faq.txt b/lib/lp/answers/stories/this-is-a-faq.txt
467index ff6e5d9..e1f4db8 100644
468--- a/lib/lp/answers/stories/this-is-a-faq.txt
469+++ b/lib/lp/answers/stories/this-is-a-faq.txt
470@@ -206,21 +206,24 @@ Since No Privileges Person isn't an answer contact for the project nor
471 the project owner, they don't have the possibility to create a new FAQ.
472
473 >>> user_browser.getLink('Create a FAQ')
474+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
475 Traceback (most recent call last):
476 ...
477- LinkNotFoundError
478+ zope.testbrowser.browser.LinkNotFoundError
479
480 >>> user_browser.getLink('Link to a FAQ').click()
481 >>> user_browser.getLink('create a new FAQ')
482+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
483 Traceback (most recent call last):
484 ...
485- LinkNotFoundError
486+ zope.testbrowser.browser.LinkNotFoundError
487
488 >>> user_browser.open(
489 ... 'http://answers.launchpad.test/firefox/+question/2/+createfaq')
490+ ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
491 Traceback (most recent call last):
492 ...
493- Unauthorized: ...
494+ zope.security.interfaces.Unauthorized: ...
495
496 Sample Person who is the project owner does have that ability.
497
498diff --git a/lib/lp/testing/pages.py b/lib/lp/testing/pages.py
499index e620147..7cb4746 100644
500--- a/lib/lp/testing/pages.py
501+++ b/lib/lp/testing/pages.py
502@@ -929,10 +929,8 @@ def PageTestSuite(storydir, package=None, setUp=setUpGlobs, **kw):
503 suite = unittest.TestSuite()
504 # Add tests to the suite individually.
505 if filenames:
506- checker = doctest.OutputChecker()
507 paths = [os.path.join(storydir, filename) for filename in filenames]
508 suite.addTest(LayeredDocFileSuite(
509- paths=paths,
510- package=package, checker=checker, stdout_logging=False,
511+ paths=paths, package=package, stdout_logging=False,
512 layer=PageTestLayer, setUp=setUp, **kw))
513 return suite
514diff --git a/lib/lp/testing/systemdocs.py b/lib/lp/testing/systemdocs.py
515index 706fa75..216ab84 100644
516--- a/lib/lp/testing/systemdocs.py
517+++ b/lib/lp/testing/systemdocs.py
518@@ -29,6 +29,7 @@ import six
519 import transaction
520 from zope.component import getUtility
521 from zope.testing.loggingsupport import Handler
522+from zope.testing.renormalizing import OutputChecker
523
524 from lp.services.config import config
525 from lp.services.database.sqlbase import flush_database_updates
526@@ -81,6 +82,9 @@ class FilePrefixStrippingDocTestParser(doctest.DocTestParser):
527 default_parser = FilePrefixStrippingDocTestParser()
528
529
530+default_checker = OutputChecker()
531+
532+
533 class StdoutHandler(Handler):
534 """A logging handler that prints log messages to sys.stdout.
535
536@@ -147,6 +151,7 @@ def LayeredDocFileSuite(paths, id_extensions=None, **kw):
537 id_extensions = []
538 kw.setdefault('optionflags', default_optionflags)
539 kw.setdefault('parser', default_parser)
540+ kw.setdefault('checker', default_checker)
541
542 # Make sure that paths are resolved relative to our caller
543 kw['package'] = doctest._normalize_module(kw.get('package'))

Subscribers

People subscribed via source and target branches

to status/vote changes: