Commit 4e9dbfba authored by Benjamin Peterson's avatar Benjamin Peterson

explicitly close files (closes #23090)

Patch by Brian Kearns.
parent 74a651b4
...@@ -2580,7 +2580,8 @@ Windows line endings first: ...@@ -2580,7 +2580,8 @@ Windows line endings first:
>>> import tempfile, os >>> import tempfile, os
>>> fn = tempfile.mktemp() >>> 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 f:
... f.write('Test:\r\n\r\n >>> x = 1 + 1\r\n\r\nDone.\r\n')
>>> doctest.testfile(fn, False) >>> doctest.testfile(fn, False)
TestResults(failed=0, attempted=1) TestResults(failed=0, attempted=1)
>>> os.remove(fn) >>> os.remove(fn)
...@@ -2588,7 +2589,8 @@ Windows line endings first: ...@@ -2588,7 +2589,8 @@ Windows line endings first:
And now *nix line endings: And now *nix line endings:
>>> fn = tempfile.mktemp() >>> fn = tempfile.mktemp()
>>> open(fn, 'w').write('Test:\n\n >>> x = 1 + 1\n\nDone.\n') >>> with open(fn, 'w') as f:
... f.write('Test:\n\n >>> x = 1 + 1\n\nDone.\n')
>>> doctest.testfile(fn, False) >>> doctest.testfile(fn, False)
TestResults(failed=0, attempted=1) TestResults(failed=0, attempted=1)
>>> os.remove(fn) >>> os.remove(fn)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment