Merge lp:~cjwatson/lazr.restful/docutils-0.8-compat into lp:lazr.restful

Proposed by Colin Watson
Status: Merged
Merged at revision: 217
Proposed branch: lp:~cjwatson/lazr.restful/docutils-0.8-compat
Merge into: lp:lazr.restful
Diff against target: 43 lines (+9/-2)
3 files modified
setup.py (+1/-1)
src/lazr/restful/NEWS.txt (+6/-0)
src/lazr/restful/tales.py (+2/-1)
To merge this branch: bzr merge lp:~cjwatson/lazr.restful/docutils-0.8-compat
Reviewer Review Type Date Requested Status
Maximiliano Bertacchini (community) Approve
LAZR Developers Pending
Review via email: mp+338432@code.launchpad.net

Commit message

Fix compatibility with docutils >= 0.8 under "zope.testrunner --subunit".

Description of the change

When zope.testrunner is asked for subunit output, it replaces sys.stdout with a StringIO. Following http://repo.or.cz/docutils.git/commitdiff/14cde9fb, this confuses docutils into autoclosing the stdout stream in use by subunit, which broke the Launchpad test suite following an upgrade to docutils 0.14.

_PydocParser uses epydoc.markup.restructuredtext._DocumentPseudoWriter, which never writes any output, so the simplest fix for this is just to tell docutils.core.Publisher to use docutils.io.NullOutput for its output, which removes any risk of it going anywhere near stdout.

To post a comment you must log in.
Revision history for this message
Maximiliano Bertacchini (maxiberta) wrote :

Looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'setup.py'
--- setup.py 2016-02-17 01:07:21 +0000
+++ setup.py 2018-02-21 15:07:55 +0000
@@ -53,7 +53,7 @@
53 'src/lazr/restful/NEWS.txt'),53 'src/lazr/restful/NEWS.txt'),
54 license='LGPL v3',54 license='LGPL v3',
55 install_requires=[55 install_requires=[
56 'docutils',56 'docutils>=0.3.7',
57 'epydoc', # used by wadl generation57 'epydoc', # used by wadl generation
58 'grokcore.component==1.6',58 'grokcore.component==1.6',
59 'lazr.batchnavigator>=1.2.0-dev',59 'lazr.batchnavigator>=1.2.0-dev',
6060
=== modified file 'src/lazr/restful/NEWS.txt'
--- src/lazr/restful/NEWS.txt 2017-06-29 00:36:47 +0000
+++ src/lazr/restful/NEWS.txt 2018-02-21 15:07:55 +0000
@@ -2,6 +2,12 @@
2NEWS for lazr.restful2NEWS for lazr.restful
3=====================3=====================
44
50.20.1
6======
7
8Adjust docstring rendering to avoid closing sys.stdout when running under
9"zope.testrunner --subunit" with docutils >= 0.8.
10
50.20.0 (2017-06-29)110.20.0 (2017-06-29)
6===================12===================
713
814
=== modified file 'src/lazr/restful/tales.py'
--- src/lazr/restful/tales.py 2016-02-17 01:07:21 +0000
+++ src/lazr/restful/tales.py 2018-02-21 15:07:55 +0000
@@ -83,7 +83,8 @@
83 self.writer = _DocumentPseudoWriter()83 self.writer = _DocumentPseudoWriter()
84 self.publisher = Publisher(_EpydocReader(self.errors),84 self.publisher = Publisher(_EpydocReader(self.errors),
85 writer=self.writer,85 writer=self.writer,
86 source_class=io.StringInput)86 source_class=io.StringInput,
87 destination_class=io.NullOutput)
87 self.publisher.set_components('standalone', 'restructuredtext',88 self.publisher.set_components('standalone', 'restructuredtext',
88 'pseudoxml')89 'pseudoxml')
89 settings_overrides={90 settings_overrides={

Subscribers

People subscribed via source and target branches