[pypy-commit] pypy stdlib-2.7.9: fix test_doctest test_lineendings not closing files
bdkearns
noreply at buildbot.pypy.org
Fri Dec 19 18:49:23 CET 2014
Author: Brian Kearns <bdkearns at gmail.com>
Branch: stdlib-2.7.9
Changeset: r75038:11ea34526fbb
Date: 2014-12-19 12:45 -0500
http://bitbucket.org/pypy/pypy/changeset/11ea34526fbb/
Log: fix test_doctest test_lineendings not closing files
diff --git a/lib-python/2.7/test/test_doctest.py b/lib-python/2.7/test/test_doctest.py
--- a/lib-python/2.7/test/test_doctest.py
+++ b/lib-python/2.7/test/test_doctest.py
@@ -2580,7 +2580,8 @@
>>> import tempfile, os
>>> fn = tempfile.mktemp()
- >>> open(fn, 'w').write('Test:\r\n\r\n >>> x = 1 + 1\r\n\r\nDone.\r\n')
+ >>> with open(fn, 'w') as fobj:
+ ... fobj.write('Test:\r\n\r\n >>> x = 1 + 1\r\n\r\nDone.\r\n')
>>> doctest.testfile(fn, False)
TestResults(failed=0, attempted=1)
>>> os.remove(fn)
@@ -2588,7 +2589,8 @@
And now *nix line endings:
>>> fn = tempfile.mktemp()
- >>> open(fn, 'w').write('Test:\n\n >>> x = 1 + 1\n\nDone.\n')
+ >>> with open(fn, 'w') as fobj:
+ ... fobj.write('Test:\n\n >>> x = 1 + 1\n\nDone.\n')
>>> doctest.testfile(fn, False)
TestResults(failed=0, attempted=1)
>>> os.remove(fn)
More information about the pypy-commit
mailing list