[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Test used 'with' for tarfiles, breaking python 2.6



commit 16287558bc585af3f280ef601b9526032489d104
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sat Jun 7 11:01:56 2014 -0700

    Test used 'with' for tarfiles, breaking python 2.6
    
    Integ tests couldn't pass with python 2.6 because we started using with for
    tarfiles. We already accounted for this in all our other tarfile uses - just a
    regression in a newly added test.
---
 test/integ/descriptor/server_descriptor.py |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/test/integ/descriptor/server_descriptor.py b/test/integ/descriptor/server_descriptor.py
index 6d16add..fef9264 100644
--- a/test/integ/descriptor/server_descriptor.py
+++ b/test/integ/descriptor/server_descriptor.py
@@ -41,12 +41,16 @@ class TestServerDescriptor(unittest.TestCase):
     Fetch server descriptors via parse_file() for a tarfile object.
     """
 
-    with tarfile.open(TARFILE_PATH) as tar_file:
-      descriptors = list(stem.descriptor.parse_file(tar_file))
-      self.assertEqual(3, len(descriptors))
+    # TODO: When dropping python 2.6 support we can go back to using the 'with'
+    # keyword here.
 
-      fingerprints = set([desc.fingerprint for desc in descriptors])
-      self.assertEqual(TARFILE_FINGERPRINTS, fingerprints)
+    tar_file = tarfile.open(TARFILE_PATH)
+    descriptors = list(stem.descriptor.parse_file(tar_file))
+    self.assertEqual(3, len(descriptors))
+
+    fingerprints = set([desc.fingerprint for desc in descriptors])
+    self.assertEqual(TARFILE_FINGERPRINTS, fingerprints)
+    tar_file.close()
 
   def test_metrics_descriptor(self):
     """



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits