← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Colin Watson has proposed merging ~cjwatson/launchpad:fix-py3-registry-exception-modules into launchpad:master.

Commit message:
Fix lp.registry.model.projectgroup doctests

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/397358

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.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-py3-registry-exception-modules into launchpad:master.
diff --git a/lib/lp/registry/model/projectgroup.py b/lib/lp/registry/model/projectgroup.py
index d668bf4..9101b8c 100644
--- a/lib/lp/registry/model/projectgroup.py
+++ b/lib/lp/registry/model/projectgroup.py
@@ -539,6 +539,7 @@ class ProjectGroupSet:
         >>> getUtility(IProjectGroupSet).get(1).name
         u'apache'
         >>> getUtility(IProjectGroupSet).get(-1)
+        ... # doctest: +NORMALIZE_WHITESPACE
         ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
         Traceback (most recent call last):
         ...
diff --git a/lib/lp/registry/tests/test_doc_project.py b/lib/lp/registry/tests/test_doc_project.py
index dd4b773..0e9aaa0 100644
--- a/lib/lp/registry/tests/test_doc_project.py
+++ b/lib/lp/registry/tests/test_doc_project.py
@@ -6,6 +6,7 @@ __metaclass__ = type
 from doctest import DocTestSuite
 
 from zope.component import getUtility
+from zope.testing.renormalizing import OutputChecker
 
 from lp.testing import (
     ANONYMOUS,
@@ -20,6 +21,7 @@ def setUp(test):
 
 
 def test_suite():
-    suite = DocTestSuite('lp.registry.model.projectgroup', setUp=setUp)
+    suite = DocTestSuite(
+        'lp.registry.model.projectgroup', setUp=setUp, checker=OutputChecker())
     suite.layer = LaunchpadFunctionalLayer
     return suite