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

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 30a7664507d879238f6fad0700abd0f13aac61e1
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:fix-py3-registry-exception-modules
Merge into: launchpad:master
Diff against target: 33 lines (+4/-1)
2 files modified
lib/lp/registry/model/projectgroup.py (+1/-0)
lib/lp/registry/tests/test_doc_project.py (+3/-1)
Reviewer Review Type Date Requested Status
Tom Wardill (community) Approve
Review via email: mp+397358@code.launchpad.net

Commit message

Fix lp.registry.model.projectgroup doctests

Description of the change

Broken by converting to IGNORE_EXCEPTION_MODULE_IN_PYTHON2, mainly because I forgot to tell it to use the correct checker.

NORMALIZE_WHITESPACE is required because OutputChecker seems to get a bit confused by an extra newline at the end of examples found in docstring-based doctests. This is probably a bug in zope.testing, but since it's only needed for migration from Python 2 and is easy enough to work around like this, it doesn't seem worth the effort to fix properly.

To post a comment you must log in.
Revision history for this message
Tom Wardill (twom) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/registry/model/projectgroup.py b/lib/lp/registry/model/projectgroup.py
2index d668bf4..9101b8c 100644
3--- a/lib/lp/registry/model/projectgroup.py
4+++ b/lib/lp/registry/model/projectgroup.py
5@@ -539,6 +539,7 @@ class ProjectGroupSet:
6 >>> getUtility(IProjectGroupSet).get(1).name
7 u'apache'
8 >>> getUtility(IProjectGroupSet).get(-1)
9+ ... # doctest: +NORMALIZE_WHITESPACE
10 ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
11 Traceback (most recent call last):
12 ...
13diff --git a/lib/lp/registry/tests/test_doc_project.py b/lib/lp/registry/tests/test_doc_project.py
14index dd4b773..0e9aaa0 100644
15--- a/lib/lp/registry/tests/test_doc_project.py
16+++ b/lib/lp/registry/tests/test_doc_project.py
17@@ -6,6 +6,7 @@ __metaclass__ = type
18 from doctest import DocTestSuite
19
20 from zope.component import getUtility
21+from zope.testing.renormalizing import OutputChecker
22
23 from lp.testing import (
24 ANONYMOUS,
25@@ -20,6 +21,7 @@ def setUp(test):
26
27
28 def test_suite():
29- suite = DocTestSuite('lp.registry.model.projectgroup', setUp=setUp)
30+ suite = DocTestSuite(
31+ 'lp.registry.model.projectgroup', setUp=setUp, checker=OutputChecker())
32 suite.layer = LaunchpadFunctionalLayer
33 return suite

Subscribers

People subscribed via source and target branches

to status/vote changes: