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

[tor-commits] [stem/master] Integ test for get_processed_files()



commit 1bfadbca0ae379b62c140193883a833519c4a887
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sun Mar 11 13:07:12 2012 -0700

    Integ test for get_processed_files()
    
    Integration test for the get_processed_files() method of the DescriptorReader
    class. This and the test_basic_example tests are intermittendly failing right
    now which indicates a concurrency issue - though this test itself has passed
    and should be fine.
---
 test/integ/descriptor/reader.py |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/test/integ/descriptor/reader.py b/test/integ/descriptor/reader.py
index 5fa61b8..24786b7 100644
--- a/test/integ/descriptor/reader.py
+++ b/test/integ/descriptor/reader.py
@@ -162,4 +162,26 @@ class TestDescriptorReader(unittest.TestCase):
     reader.stop()
     reader.join()
     is_test_running = False
+  
+  def test_get_processed_files(self):
+    """
+    Checks that get_processed_files() provides the expected results after
+    iterating over our test data.
+    """
+    
+    expected_results = {}
+    
+    for root, _, files in os.walk(DESCRIPTOR_TEST_DATA):
+      for filename in files:
+        path = os.path.join(root, filename)
+        last_modified = os.stat(path).st_mtime
+        expected_results[path] = last_modified
+    
+    reader = stem.descriptor.reader.DescriptorReader([DESCRIPTOR_TEST_DATA])
+    
+    with reader:
+      for descriptor in reader:
+        pass
+    
+    self.assertEquals(expected_results, reader.get_processed_files())
 



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