diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2020-05-17 18:04:09 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2020-05-17 18:04:09 +0200 |
commit | bfd8df3d5eb733b1280a39cfc8a9858ab2802897 (patch) | |
tree | e69b39376ccbf03041f37432de513d56f78c274a | |
parent | b0f99bf3edcfdf52fbfa120e9e227f28b57127a2 (diff) | |
download | psutil-bfd8df3d5eb733b1280a39cfc8a9858ab2802897.tar.gz |
print sysinfo on CI
-rw-r--r-- | psutil/tests/__init__.py | 1 | ||||
-rwxr-xr-x | psutil/tests/runner.py | 39 |
2 files changed, 38 insertions, 2 deletions
diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py index 9e924856..16d4998a 100644 --- a/psutil/tests/__init__.py +++ b/psutil/tests/__init__.py @@ -157,7 +157,6 @@ if PY3: INVALID_UNICODE_SUFFIX = b"f\xc0\x80".decode('utf8', 'surrogateescape') else: INVALID_UNICODE_SUFFIX = "f\xc0\x80" - ASCII_FS = sys.getfilesystemencoding().lower() in ('ascii', 'us-ascii') # --- paths diff --git a/psutil/tests/runner.py b/psutil/tests/runner.py index 8b186203..17a17322 100755 --- a/psutil/tests/runner.py +++ b/psutil/tests/runner.py @@ -310,6 +310,42 @@ def setup(): psutil._psplatform.cext.set_testing() +def print_sysinfo(): + import collections + import datetime + import getpass + import platform + + info = collections.OrderedDict() + info['OS'] = platform.system() + if psutil.OSX: + info['version'] = str(platform.mac_ver()) + elif psutil.WINDOWS: + info['version'] = ' '.join(map(str, platform.win32_ver())) + if hasattr(platform, 'win32_edition'): + info['edition'] = platform.win32_edition() + else: + info['version'] = platform.version() + if psutil.POSIX: + info['kernel'] = platform.uname()[2] + info['arch'] = ', '.join( + list(platform.architecture()) + [platform.machine()]) + info['hostname'] = platform.node() + info['python'] = ', '.join([ + platform.python_implementation(), + platform.python_version(), + platform.python_compiler()]) + if psutil.POSIX: + info['glibc'] = platform.libc_ver()[1] + info['fs-encoding'] = sys.getfilesystemencoding() + info['time'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + info['user'] = getpass.getuser() + print("=" * 70) + for k, v in info.items(): + print("%-14s %s" % (k + ':', v)) + print("=" * 70) + + def main(): setup() usage = "python3 -m psutil.tests [opts] [test-name]" @@ -338,7 +374,8 @@ def main(): else: suite = loader.all() - # runner + if CI_TESTING: + print_sysinfo() runner = get_runner(opts.parallel) runner.run(suite) |