[tor-commits] [ooni-probe/master] Fix bug that resulted in inconsistencies in test_id

art at torproject.org art at torproject.org
Wed Jun 19 12:32:46 UTC 2013


commit eae2c1ec99fb231d169cda14375c4953be50ac44
Author: Arturo Filastò <art at fuffa.org>
Date:   Fri Jun 14 19:44:07 2013 +0200

    Fix bug that resulted in inconsistencies in test_id
---
 ooni/nettest.py |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/ooni/nettest.py b/ooni/nettest.py
index 80c1965..10eacd3 100644
--- a/ooni/nettest.py
+++ b/ooni/nettest.py
@@ -141,6 +141,9 @@ def getArguments(test_class):
 
     return arguments
 
+def test_class_name_to_name(test_class_name):
+    return test_class_name.lower().replace(' ','_')
+
 def getNetTestInformation(net_test_file):
     """
     Returns a dict containing:
@@ -156,7 +159,7 @@ def getNetTestInformation(net_test_file):
     """
     test_class = getTestClassFromFile(net_test_file)
 
-    test_id = os.path.basename(net_test_file).replace('.py', '')
+    test_id = test_class_name_to_name(test_class.name)
     information = {'id': test_id,
         'name': test_class.name,
         'description': test_class.description,
@@ -333,7 +336,7 @@ class NetTestLoader(object):
         """
         test_class, _ = test_cases[0]
         self.testVersion = test_class.version
-        self.testName = test_class.name.lower().replace(' ','_')
+        self.testName = test_class_name_to_name(test_class.name)
         self.testCases = test_cases
 
     def checkOptions(self):





More information about the tor-commits mailing list