[tor-commits] [onionperf/master] Fixes reprocessing arguments in tests

irl at torproject.org irl at torproject.org
Mon Jul 15 20:52:33 UTC 2019


commit 6b5cefe7a1705dec74544bb0fac1230734e25f5f
Author: Ana Custura <ana at netstat.org.uk>
Date:   Mon Jul 15 20:32:31 2019 +0100

    Fixes reprocessing arguments in tests
---
 onionperf/reprocessing.py            | 2 +-
 onionperf/tests/test_reprocessing.py | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/onionperf/reprocessing.py b/onionperf/reprocessing.py
index 66b82c7..c5351d4 100644
--- a/onionperf/reprocessing.py
+++ b/onionperf/reprocessing.py
@@ -58,7 +58,7 @@ def analyze_func(prefix, nick, pair):
     return 1
 
 
-def multiprocess_logs(log_pairs, prefix, nick):
+def multiprocess_logs(log_pairs, prefix, nick=None):
     pool = Pool(cpu_count())
     analyses = None
     try:
diff --git a/onionperf/tests/test_reprocessing.py b/onionperf/tests/test_reprocessing.py
index 54b6ddf..ef800ab 100644
--- a/onionperf/tests/test_reprocessing.py
+++ b/onionperf/tests/test_reprocessing.py
@@ -61,7 +61,7 @@ def test_log_match_with_wrong_filter_date():
 def test_analyze_func_json():
     pair = (DATA_DIR + 'logs/onionperf_2019-01-10_23:59:59.tgen.log', DATA_DIR + 'logs/onionperf_2019-01-10_23:59:59.torctl.log', datetime.datetime(2019, 1, 10, 0, 0))
     work_dir = tempfile.mkdtemp()
-    reprocessing.analyze_func(work_dir, pair) 
+    reprocessing.analyze_func(work_dir, None, pair)
     json_file = os.path.join(work_dir, "2019-01-10.onionperf.analysis.json.xz")
     assert(os.path.exists(json_file))
     for i in ['51200',  '5242880', '1048576']: 
@@ -72,7 +72,7 @@ def test_analyze_func_json():
 def test_multiprocess_logs():
     pairs = [(DATA_DIR + 'logs/onionperf_2019-01-10_23:59:59.tgen.log', DATA_DIR + 'logs/onionperf_2019-01-10_23:59:59.torctl.log', datetime.datetime(2019, 1, 10, 0, 0))]
     work_dir = tempfile.mkdtemp()
-    reprocessing.multiprocess_logs(pairs, work_dir) 
+    reprocessing.multiprocess_logs(pairs, work_dir)
     json_file = os.path.join(work_dir, "2019-01-10.onionperf.analysis.json.xz")
     assert(os.path.exists(json_file))
     for i in ['51200',  '5242880', '1048576']: 
@@ -85,7 +85,7 @@ def test_end_to_end():
     torctl_logs = reprocessing.collect_logs(DATA_DIR, '*torctl.log')
     log_pairs =  reprocessing.match(tgen_logs, torctl_logs, None)
     work_dir = tempfile.mkdtemp()
-    reprocessing.multiprocess_logs(log_pairs, work_dir) 
+    reprocessing.multiprocess_logs(log_pairs, work_dir)
     json_file = os.path.join(work_dir, "2019-01-10.onionperf.analysis.json.xz")
     assert(os.path.exists(json_file))
     for i in ['51200',  '5242880', '1048576']: 



More information about the tor-commits mailing list