[tor-commits] [stem/master] Drop unnecessary conditional from _get_tests()

atagar at torproject.org atagar at torproject.org
Wed Jul 26 03:13:48 UTC 2017


commit 8402e0051ea08e994a3c5f43056f8611ca763b96
Author: Damian Johnson <atagar at torproject.org>
Date:   Thu Jul 20 10:34:52 2017 -0700

    Drop unnecessary conditional from _get_tests()
    
    Huh. Wonder why we checked if the import_name was present. Even if an empty
    string splitlines() will provide an empty list, not a list with a blank string.
---
 run_tests.py | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/run_tests.py b/run_tests.py
index c0d9cbc8..0a799e4a 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -105,16 +105,15 @@ def get_integ_tests(module_prefix = None):
 
 def _get_tests(modules, module_prefix):
   for import_name in modules:
-    if import_name:
-      module, module_name = import_name.rsplit('.', 1)  # example: util.conf.TestConf
+    module, module_name = import_name.rsplit('.', 1)  # example: util.conf.TestConf
 
-      if not module_prefix or module.startswith(module_prefix):
-        yield import_name
-      elif module_prefix.startswith(module):
-        # single test for this module
+    if not module_prefix or module.startswith(module_prefix):
+      yield import_name
+    elif module_prefix.startswith(module):
+      # single test for this module
 
-        test_module = module_prefix.rsplit('.', 1)[1]
-        yield '%s.%s' % (import_name, test_module)
+      test_name = module_prefix.rsplit('.', 1)[1]
+      yield '%s.%s' % (import_name, test_name)
 
 
 def get_torrc_entries(target):





More information about the tor-commits mailing list