Commit 01743684 authored by Brett Cannon's avatar Brett Cannon

Move test_linecache over to file context managers.

parent dff69853
......@@ -55,13 +55,15 @@ class LineCacheTests(unittest.TestCase):
# Check whether lines correspond to those from file iteration
for entry in TESTS:
filename = os.path.join(TEST_PATH, entry) + '.py'
for index, line in enumerate(open(filename)):
with open(filename) as file:
for index, line in enumerate(file):
self.assertEquals(line, getline(filename, index + 1))
# Check module loading
for entry in MODULES:
filename = os.path.join(MODULE_PATH, entry) + '.py'
for index, line in enumerate(open(filename)):
with open(filename) as file:
for index, line in enumerate(file):
self.assertEquals(line, getline(filename, index + 1))
# Check that bogus data isn't returned (issue #1309567)
......
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