summaryrefslogtreecommitdiff
path: root/tests/test_process.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2013-10-20 07:58:57 -0400
committerNed Batchelder <ned@nedbatchelder.com>2013-10-20 07:58:57 -0400
commit6b6a4488adc12d390c5e0c8f13829dd9bf125309 (patch)
tree4eeeeb857c02023fd46d610612f600d533105afb /tests/test_process.py
parent2e5688eedd1576e9b100386c0a9ae30828123f73 (diff)
downloadpython-coveragepy-git-6b6a4488adc12d390c5e0c8f13829dd9bf125309.tar.gz
with statements: no more finally close
--HG-- branch : 4.0
Diffstat (limited to 'tests/test_process.py')
-rw-r--r--tests/test_process.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/tests/test_process.py b/tests/test_process.py
index 4453fc57..1ab56e8f 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")