From 249ad14dfedbe45919b48dbbff445394a64d985c Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 20 Oct 2013 07:58:57 -0400 Subject: with statements: no more finally close --- tests/test_process.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'tests/test_process.py') diff --git a/tests/test_process.py b/tests/test_process.py index 4453fc5..1ab56e8 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -572,16 +572,13 @@ class ProcessStartupTest(CoverageTest): g = glob.glob(os.path.join(d, "*.pth")) if g: pth_path = os.path.join(d, "subcover.pth") - pth = open(pth_path, "w") - try: + with open(pth_path, "w") as pth: try: pth.write(pth_contents) self.pth_path = pth_path break except (IOError, OSError): # pragma: not covered pass - finally: - pth.close() else: # pragma: not covered raise Exception("Couldn't find a place for the .pth file") -- cgit v1.2.1