[tor-commits] [stem/master] Drop importlib fallback

atagar at torproject.org atagar at torproject.org
Sun Jan 5 21:39:28 UTC 2020


commit bcdfbd993ab9008ae6d36be41989fdf3d387cc3f
Author: Damian Johnson <atagar at torproject.org>
Date:   Fri Jan 3 16:30:24 2020 -0800

    Drop importlib fallback
---
 test/task.py | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/test/task.py b/test/task.py
index 70ab5e4b..19026165 100644
--- a/test/task.py
+++ b/test/task.py
@@ -24,6 +24,7 @@
   +- PYCODESTYLE_TASK - style checks
 """
 
+import importlib
 import os
 import platform
 import re
@@ -45,14 +46,6 @@ from test.output import STATUS, ERROR, NO_NL, println
 
 TASK_DESCRIPTION_WIDTH = 40
 
-try:
-  # TODO: remove check when dropping python 2.6 support
-
-  import importlib
-  HAS_IMPORTLIB = True
-except ImportError:
-  HAS_IMPORTLIB = False
-
 CONFIG = stem.util.conf.config_dict('test', {
   'integ.test_directory': './test/data',
   'test.unit_tests': '',
@@ -162,9 +155,6 @@ def _import_tests():
   register if they're asynchronous.
   """
 
-  if not HAS_IMPORTLIB:
-    return
-
   for module in (CONFIG['test.unit_tests'].splitlines() + CONFIG['test.integ_tests'].splitlines()):
     try:
       importlib.import_module(module.rsplit('.', 1)[0])
@@ -304,7 +294,7 @@ class ModuleVersion(Task):
     def version_check():
       if prereq_check is None or prereq_check():
         for module in modules:
-          if HAS_IMPORTLIB and stem.util.test_tools._module_exists(module):
+          if stem.util.test_tools._module_exists(module):
             return importlib.import_module(module).__version__
 
       return 'missing'





More information about the tor-commits mailing list