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

[tor-commits] [stem/master] State if the test doesn't exist



commit 230a8aa131dd51234fb2b8df4fae463cef5cce9b
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Tue Mar 3 09:28:35 2015 -0800

    State if the test doesn't exist
    
    Initially I planned for _get_tests() to detect if the test exists, but on
    reflection it's better if we surface it in our output...
    
      util.conf.test_parse_enum_csvv...                    no such test
    
    This way the user will be informed of the error.
---
 run_tests.py |    3 ++-
 test/util.py |    7 ++-----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/run_tests.py b/run_tests.py
index 8e2b8f2..497a3fc 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -466,7 +466,8 @@ def _run_test(args, test_class, output_filters, logging_buffer):
   try:
     suite = unittest.TestLoader().loadTestsFromName(test_class)
   except:
-    println(' failed (%0.2fs)' % (time.time() - start_time), ERROR)
+    # should only come up if user provided '--test' for something that doesn't exist
+    println(" no such test", ERROR)
     return None
 
   test_results = StringIO()
diff --git a/test/util.py b/test/util.py
index eb8b5eb..55243a3 100644
--- a/test/util.py
+++ b/test/util.py
@@ -115,12 +115,9 @@ def _get_tests(modules, module_prefix):
       if not module_prefix or module.startswith(module_prefix):
         yield import_name
       elif module_prefix.startswith(module):
-        # might be a single test in this module, check if we match any
-
-        module, test = module_prefix.rsplit('.', 1)
-
-        # TODO: should check if the test exists
+        # single test for this module
 
+        test = module_prefix.rsplit('.', 1)[1]
         yield '%s.%s' % (import_name, test)
 
 



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