aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_dist_info.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2012-10-10 10:49:54 +0100
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2012-10-10 10:49:54 +0100
commit94fc39cb62df19e85b07658f2fa5d0b4a7bf9303 (patch)
tree1c44a301f7eb2662ccc03f97685b449e2251069e /setuptools/tests/test_dist_info.py
parente3f7235a944f5758780de74aac548e27a09e39a3 (diff)
downloadexternal_python_setuptools-94fc39cb62df19e85b07658f2fa5d0b4a7bf9303.tar.gz
external_python_setuptools-94fc39cb62df19e85b07658f2fa5d0b4a7bf9303.tar.bz2
external_python_setuptools-94fc39cb62df19e85b07658f2fa5d0b4a7bf9303.zip
Fixed some resource leaks.
--HG-- branch : distribute extra : source : 98c929e25fee11a99eb125dd9a13521321d68dd3
Diffstat (limited to 'setuptools/tests/test_dist_info.py')
-rw-r--r--setuptools/tests/test_dist_info.py43
1 files changed, 25 insertions, 18 deletions
diff --git a/setuptools/tests/test_dist_info.py b/setuptools/tests/test_dist_info.py
index 623ccc47..93ab8816 100644
--- a/setuptools/tests/test_dist_info.py
+++ b/setuptools/tests/test_dist_info.py
@@ -50,27 +50,34 @@ class TestDistInfo(unittest.TestCase):
versioned = os.path.join(self.tmpdir,
'VersionedDistribution-2.718.dist-info')
os.mkdir(versioned)
- open(os.path.join(versioned, 'METADATA'), 'w+').write(DALS(
- """
- Metadata-Version: 1.2
- Name: VersionedDistribution
- Requires-Dist: splort (4)
- Provides-Extra: baz
- Requires-Dist: quux (>=1.1); extra == 'baz'
- """))
-
+ f = open(os.path.join(versioned, 'METADATA'), 'w+')
+ try:
+ f.write(DALS(
+ """
+ Metadata-Version: 1.2
+ Name: VersionedDistribution
+ Requires-Dist: splort (4)
+ Provides-Extra: baz
+ Requires-Dist: quux (>=1.1); extra == 'baz'
+ """))
+ finally:
+ f.close()
unversioned = os.path.join(self.tmpdir,
'UnversionedDistribution.dist-info')
os.mkdir(unversioned)
- open(os.path.join(unversioned, 'METADATA'), 'w+').write(DALS(
- """
- Metadata-Version: 1.2
- Name: UnversionedDistribution
- Version: 0.3
- Requires-Dist: splort (==4)
- Provides-Extra: baz
- Requires-Dist: quux (>=1.1); extra == 'baz'
- """))
+ f = open(os.path.join(unversioned, 'METADATA'), 'w+')
+ try:
+ f.write(DALS(
+ """
+ Metadata-Version: 1.2
+ Name: UnversionedDistribution
+ Version: 0.3
+ Requires-Dist: splort (==4)
+ Provides-Extra: baz
+ Requires-Dist: quux (>=1.1); extra == 'baz'
+ """))
+ finally:
+ f.close()
def tearDown(self):
shutil.rmtree(self.tmpdir)