Rev 5821: Avoid using 'with' until we drop python2.4/2.5 compatibility. in file:///home/vila/src/bzr/reviews/export-tt/

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu May 5 11:06:13 UTC 2011


At file:///home/vila/src/bzr/reviews/export-tt/

------------------------------------------------------------
revno: 5821
revision-id: v.ladeuil+lp at free.fr-20110505110613-7qiixqlegp9nrf9x
parent: aaron at aaronbentley.com-20110430040622-w7irrrowr02mm0wo
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: export-tt
timestamp: Thu 2011-05-05 13:06:13 +0200
message:
  Avoid using 'with' until we drop python2.4/2.5 compatibility.
-------------- next part --------------
=== modified file 'bzrlib/tests/per_tree/test_export.py'
--- a/bzrlib/tests/per_tree/test_export.py	2011-04-30 00:18:56 +0000
+++ b/bzrlib/tests/per_tree/test_export.py	2011-05-05 11:06:13 +0000
@@ -62,8 +62,11 @@
     exporter = 'tar'
 
     def get_export_names(self):
-        with tarfile.open('output') as tf:
+        tf = tarfile.open('output')
+        try:
             return tf.getnames()
+        finally:
+            tf.close()
 
 
 class TestZip(ExportTest, TestCaseWithTree):
@@ -71,8 +74,11 @@
     exporter = 'zip'
 
     def get_export_names(self):
-        with zipfile.ZipFile('output') as zf:
+        zf = tarfile.open('output')
+        try:
             return zf.namelist()
+        finally:
+            zf.close()
 
     def test_export_symlink(self):
         self.prepare_symlink_export()



More information about the bazaar-commits mailing list