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

[tor-commits] [stem/master] Note operating system in test output



commit 7760f7498695137812729028d0ca70d6ba12c5e2
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sat Oct 6 10:46:17 2018 -0700

    Note operating system in test output
    
    Some tests rely on this, so including it with our versioning info.
---
 run_tests.py |  1 +
 test/task.py | 38 +++++++++++++++++++++++++++-----------
 2 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/run_tests.py b/run_tests.py
index 564ab4dd..bd0839c9 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -161,6 +161,7 @@ def main():
     test.task.STEM_VERSION,
     test.task.TOR_VERSION if args.run_integ else None,
     test.task.PYTHON_VERSION,
+    test.task.PLATFORM_VERSION,
     test.task.CRYPTO_VERSION,
     test.task.PYNACL_VERSION,
     test.task.MOCK_VERSION,
diff --git a/test/task.py b/test/task.py
index 89437c77..d1c1d6c7 100644
--- a/test/task.py
+++ b/test/task.py
@@ -7,9 +7,10 @@
 ::
 
   Initialization Tasks
-  |- STEM_VERSION - checks our version of stem
-  |- TOR_VERSION - checks our version of tor
-  |- PYTHON_VERSION - checks our version of python
+  |- STEM_VERSION - checks our stem version
+  |- TOR_VERSION - checks our tor version
+  |- PYTHON_VERSION - checks our python version
+  |- PLATFORM_VERSION - checks our operating system version
   |- CRYPTO_VERSION - checks our version of cryptography
   |- PYNACL_VERSION - checks our version of pynacl
   |- MOCK_VERSION - checks our version of mock
@@ -23,6 +24,7 @@
 """
 
 import os
+import platform
 import re
 import sys
 import time
@@ -73,6 +75,19 @@ def _check_tor_version(tor_path):
   return str(test.tor_version(tor_path)).split()[0]
 
 
+def _check_platform_version():
+  if platform.system() == 'Windows':
+    extra = platform.release()
+  elif platform.system() == 'Darwin':
+    extra = platform.release()
+  elif platform.system() == 'Linux':
+    extra = ' '.join(platform.linux_distribution()[:2])
+  else:
+    extra = None
+
+  return '%s (%s)' % (platform.system(), extra) if extra else platform.system()
+
+
 def _clean_orphaned_pyc(paths):
   """
   Deletes any file with a *.pyc extention without a corresponding *.py.
@@ -254,14 +269,15 @@ class StaticCheckTask(Task):
       println('unavailable', STATUS)
 
 
-STEM_VERSION = Task('checking stem version', lambda: stem.__version__)
-TOR_VERSION = Task('checking tor version', _check_tor_version)
-PYTHON_VERSION = Task('checking python version', lambda: '.'.join(map(str, sys.version_info[:3])))
-CRYPTO_VERSION = ModuleVersion('checking cryptography version', 'cryptography', stem.prereq.is_crypto_available)
-PYNACL_VERSION = ModuleVersion('checking pynacl version', 'nacl', stem.prereq._is_pynacl_available)
-MOCK_VERSION = ModuleVersion('checking mock version', ['unittest.mock', 'mock'], stem.prereq.is_mock_available)
-PYFLAKES_VERSION = ModuleVersion('checking pyflakes version', 'pyflakes')
-PYCODESTYLE_VERSION = ModuleVersion('checking pycodestyle version', ['pycodestyle', 'pep8'])
+STEM_VERSION = Task('stem version', lambda: stem.__version__)
+TOR_VERSION = Task('tor version', _check_tor_version)
+PYTHON_VERSION = Task('python version', lambda: platform.python_version())
+PLATFORM_VERSION = Task('operating system version', _check_platform_version)
+CRYPTO_VERSION = ModuleVersion('cryptography version', 'cryptography', stem.prereq.is_crypto_available)
+PYNACL_VERSION = ModuleVersion('pynacl version', 'nacl', stem.prereq._is_pynacl_available)
+MOCK_VERSION = ModuleVersion('mock version', ['unittest.mock', 'mock'], stem.prereq.is_mock_available)
+PYFLAKES_VERSION = ModuleVersion('pyflakes version', 'pyflakes')
+PYCODESTYLE_VERSION = ModuleVersion('pycodestyle version', ['pycodestyle', 'pep8'])
 CLEAN_PYC = Task('checking for orphaned .pyc files', _clean_orphaned_pyc, (SRC_PATHS,), print_runtime = True)
 IMPORT_TESTS = Task('importing test modules', _import_tests, print_runtime = True)
 

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