summaryrefslogtreecommitdiff
path: root/tests/test_execfile.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2013-12-13 22:45:10 -0500
committerNed Batchelder <ned@nedbatchelder.com>2013-12-13 22:45:10 -0500
commit2df9b1c35cbb5c92204fc5923368a3d619a34f6d (patch)
treed1ede8ffef812ba4e345b08f698f001ebe69cb56 /tests/test_execfile.py
parent84221611890880b749dbb650e8d07ac8918dba46 (diff)
parent7c66441eab3af17539c478a2cb4e19cd93ba0cf4 (diff)
downloadpython-coveragepy-git-2df9b1c35cbb5c92204fc5923368a3d619a34f6d.tar.gz
Merged 4.0 to default
Diffstat (limited to 'tests/test_execfile.py')
-rw-r--r--tests/test_execfile.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/tests/test_execfile.py b/tests/test_execfile.py
index 24c521bd..ca13d7c8 100644
--- a/tests/test_execfile.py
+++ b/tests/test_execfile.py
@@ -54,11 +54,8 @@ class RunFileTest(CoverageTest):
# Make sure we can read any sort of line ending.
pylines = """# try newlines|print('Hello, world!')|""".split('|')
for nl in ('\n', '\r\n', '\r'):
- fpy = open('nl.py', 'wb')
- try:
+ with open('nl.py', 'wb') as fpy:
fpy.write(nl.join(pylines).encode('utf-8'))
- finally:
- fpy.close()
run_python_file('nl.py', ['nl.py'])
self.assertEqual(self.stdout(), "Hello, world!\n"*3)