[tor-commits] [stem/master] Making _get_raw_tar_descriptors() thread safe
atagar at torproject.org
atagar at torproject.org
Mon Mar 26 00:10:01 UTC 2012
commit 5b7eacfce6ac4f370dfb4fb1baa293c4b934689f
Author: Damian Johnson <atagar at torproject.org>
Date: Tue Mar 13 09:26:01 2012 -0700
Making _get_raw_tar_descriptors() thread safe
At present integ tests are single threaded, but there's a project proposal to
change that and spawn threads for each target. Fixing this helper function so
it won't be sad when that day comes.
---
test/integ/descriptor/reader.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/test/integ/descriptor/reader.py b/test/integ/descriptor/reader.py
index 55644b4..cdc33c2 100644
--- a/test/integ/descriptor/reader.py
+++ b/test/integ/descriptor/reader.py
@@ -21,7 +21,7 @@ BASIC_LISTING = """
my_dir = os.path.dirname(__file__)
DESCRIPTOR_TEST_DATA = os.path.join(my_dir, "data")
-TAR_DESCRIPTORS = []
+TAR_DESCRIPTORS = None
def _get_processed_files_path():
return os.path.join(test.runner.get_runner().get_test_dir(), "descriptor_processed_files")
@@ -45,13 +45,16 @@ def _get_raw_tar_descriptors():
if not TAR_DESCRIPTORS:
test_path = os.path.join(DESCRIPTOR_TEST_DATA, "descriptor_archive.tar")
+ raw_descriptors = []
with tarfile.open(test_path) as tar_file:
for tar_entry in tar_file:
if tar_entry.isfile():
entry = tar_file.extractfile(tar_entry)
- TAR_DESCRIPTORS.append(entry.read())
+ raw_descriptors.append(entry.read())
entry.close()
+
+ TAR_DESCRIPTORS = raw_descriptors
return TAR_DESCRIPTORS
More information about the tor-commits
mailing list