[tor-commits] [stem] 06/20: Fix getting version of `unittest.mock`

gitolite role git at cupani.torproject.org
Thu Jun 1 19:24:14 UTC 2023


This is an automated email from the git hooks/post-receive script.

atagar pushed a commit to branch maint
in repository stem.

commit f4d7028fed20181a3a4d93f9b78ba40e8d4e19fd
Author: juga <juga at riseup.net>
AuthorDate: Wed May 31 07:12:02 2023 +0000

    Fix getting version of `unittest.mock`
---
 test/task.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/test/task.py b/test/task.py
index 272c4ddf..118ba8e1 100644
--- a/test/task.py
+++ b/test/task.py
@@ -306,7 +306,14 @@ class ModuleVersion(Task):
       if prereq_check is None or prereq_check():
         for module in modules:
           if HAS_IMPORTLIB and stem.util.test_tools._module_exists(module):
-            return importlib.import_module(module).__version__
+            # unittest.mock has no attribute `__version__`: just use empty
+            # string for native modules' version.
+            try:
+              version = importlib.import_module(module).__version__
+            except Exception:
+              version = ''
+            finally:
+              return version
 
       return 'missing'
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list