summaryrefslogtreecommitdiff
path: root/Lib/packaging/tests/support.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/packaging/tests/support.py')
-rw-r--r--Lib/packaging/tests/support.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/Lib/packaging/tests/support.py b/Lib/packaging/tests/support.py
index cf5d7883a9..dbd8683269 100644
--- a/Lib/packaging/tests/support.py
+++ b/Lib/packaging/tests/support.py
@@ -146,11 +146,8 @@ class TempdirManager:
"""
if isinstance(path, (list, tuple)):
path = os.path.join(*path)
- f = open(path, 'w')
- try:
+ with open(path, 'w') as f:
f.write(content)
- finally:
- f.close()
def create_dist(self, **kw):
"""Create a stub distribution object and files.