← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-tempfile-handling into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-tempfile-handling into launchpad:master.

Commit message:
Fix temporary file creation for Python 3 in some doctests

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/397931
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-tempfile-handling into launchpad:master.
diff --git a/lib/lp/app/doc/menus.txt b/lib/lp/app/doc/menus.txt
index a084296..69f1036 100644
--- a/lib/lp/app/doc/menus.txt
+++ b/lib/lp/app/doc/menus.txt
@@ -1113,7 +1113,7 @@ NavigationMenus used in the previous TALES section.
     ...      </li>
     ...    </ul>
     ...  </div>"""
-    >>> template_file = tempfile.NamedTemporaryFile()
+    >>> template_file = tempfile.NamedTemporaryFile(mode='w')
     >>> _ = template_file.write(menu_fragment)
     >>> template_file.flush()
 
diff --git a/lib/lp/services/scripts/doc/scripts-and-zcml.txt b/lib/lp/services/scripts/doc/scripts-and-zcml.txt
index 989911a..73386e4 100644
--- a/lib/lp/services/scripts/doc/scripts-and-zcml.txt
+++ b/lib/lp/services/scripts/doc/scripts-and-zcml.txt
@@ -11,7 +11,7 @@ to demonstrate this:
     >>> import subprocess
     >>> import tempfile
     >>> from textwrap import dedent
-    >>> script_file = tempfile.NamedTemporaryFile()
+    >>> script_file = tempfile.NamedTemporaryFile(mode='w')
     >>> _ = script_file.write(dedent("""\
     ...     from __future__ import absolute_import, print_function
     ...