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

[tor-commits] [stem/master] Drop python 2.6 integ test serialization



commit c2dabe1746164db61efab357cd6d5ce5d61e99f7
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Mon May 27 16:57:30 2019 -0700

    Drop python 2.6 integ test serialization
    
    When running our integ tests using python 2.6 we dropped test parallelization.
    Turns out this no longer works, failing all asynchronous tests with...
    
      ======================================================================
      FAIL: test_cached_descriptor
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/home/atagar/Desktop/stem/stem/util/test_tools.py", line 152, in <lambda>
          self.method = lambda test: self.result(test)  # method that can be mixed into TestCases
        File "/home/atagar/Desktop/stem/stem/util/test_tools.py", line 227, in result
          test.fail(self._result.msg)
      AssertionError: Traceback (most recent call last):
        File "/home/atagar/Desktop/stem/stem/util/test_tools.py", line 169, in _wrapper
          runner(*args) if args else runner()
      TypeError: test_cached_descriptor() takes exactly 1 argument (0 given)
    
    Python 2.x is getting deprecated at the end of this year so rather than puzzle
    over this lets simply drop the pretense at a python 2.6 hack. If we really need
    python 2.6 testing I'll dig into what's up.
---
 run_tests.py | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/run_tests.py b/run_tests.py
index a2f58f83..54fbbde1 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -7,6 +7,7 @@ Runs unit and integration tests. For usage information run this with '--help'.
 """
 
 import errno
+import importlib
 import multiprocessing
 import os
 import signal
@@ -17,14 +18,6 @@ import traceback
 import unittest
 
 try:
-  # TODO: added in python 2.7, drop check when removing 2.6 support
-
-  import importlib
-  RUN_ASYNC_TESTS = True
-except ImportError:
-  RUN_ASYNC_TESTS = False
-
-try:
   from StringIO import StringIO
 except ImportError:
   from io import StringIO
@@ -256,15 +249,14 @@ def main():
     async_args = test.AsyncTestArgs(default_test_dir, args.tor_path)
 
     for module_str in stem.util.test_tools.ASYNC_TESTS:
-      if RUN_ASYNC_TESTS and (not args.specific_test or module_str.startswith(args.specific_test)):
-        module = importlib.import_module(module_str.rsplit('.', 1)[0])
-        test_classes = [v for k, v in module.__dict__.items() if k.startswith('Test')]
+      module = importlib.import_module(module_str.rsplit('.', 1)[0])
+      test_classes = [v for k, v in module.__dict__.items() if k.startswith('Test')]
 
-        if len(test_classes) != 1:
-          print('BUG: Detected multiple tests for %s: %s' % (module_str, ', '.join(test_classes)))
-          sys.exit(1)
+      if len(test_classes) != 1:
+        print('BUG: Detected multiple tests for %s: %s' % (module_str, ', '.join(test_classes)))
+        sys.exit(1)
 
-        test_classes[0].run_tests(async_args)
+      test_classes[0].run_tests(async_args)
 
   if args.run_unit:
     test.output.print_divider('UNIT TESTS', True)



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