diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2020-05-17 18:41:02 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2020-05-17 18:41:02 +0200 |
commit | e888dc0dde24d41223c89db6d13e8b90beb8c6fc (patch) | |
tree | 45ea26e4a15291e54b35e52cb41af6034d33920c | |
parent | bfd8df3d5eb733b1280a39cfc8a9858ab2802897 (diff) | |
download | psutil-e888dc0dde24d41223c89db6d13e8b90beb8c6fc.tar.gz |
small refactoring
-rw-r--r-- | psutil/tests/__init__.py | 8 | ||||
-rwxr-xr-x | psutil/tests/runner.py | 14 |
2 files changed, 13 insertions, 9 deletions
diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py index 16d4998a..811132fa 100644 --- a/psutil/tests/__init__.py +++ b/psutil/tests/__init__.py @@ -120,10 +120,10 @@ __all__ = [ TOX = os.getenv('TOX') or '' in ('1', 'true') PYPY = '__pypy__' in sys.builtin_module_names # whether we're running this test suite on a Continuous Integration service -TRAVIS = bool(os.environ.get('TRAVIS')) -APPVEYOR = bool(os.environ.get('APPVEYOR')) -CIRRUS = bool(os.environ.get('CIRRUS')) -GITHUB_WHEELS = bool(os.environ.get('CIBUILDWHEEL', False)) +TRAVIS = 'TRAVIS' in os.environ +APPVEYOR = 'APPVEYOR' in os.environ +CIRRUS = 'CIRRUS' in os.environ +GITHUB_WHEELS = 'CIBUILDWHEEL' in os.environ CI_TESTING = TRAVIS or APPVEYOR or CIRRUS or GITHUB_WHEELS # --- configurable defaults diff --git a/psutil/tests/runner.py b/psutil/tests/runner.py index 17a17322..8a8443f0 100755 --- a/psutil/tests/runner.py +++ b/psutil/tests/runner.py @@ -315,6 +315,7 @@ def print_sysinfo(): import datetime import getpass import platform + from psutil.tests import get_kernel_version info = collections.OrderedDict() info['OS'] = platform.system() @@ -327,7 +328,7 @@ def print_sysinfo(): else: info['version'] = platform.version() if psutil.POSIX: - info['kernel'] = platform.uname()[2] + info['kernel'] = '.'.join(map(str, get_kernel_version())) info['arch'] = ', '.join( list(platform.architecture()) + [platform.machine()]) info['hostname'] = platform.node() @@ -336,14 +337,17 @@ def print_sysinfo(): platform.python_version(), platform.python_compiler()]) if psutil.POSIX: - info['glibc'] = platform.libc_ver()[1] + s = platform.libc_ver()[1] + if s: + info['glibc'] = s info['fs-encoding'] = sys.getfilesystemencoding() info['time'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") info['user'] = getpass.getuser() - print("=" * 70) + info['pid'] = os.getpid() + print("=" * 70, flush=True) for k, v in info.items(): - print("%-14s %s" % (k + ':', v)) - print("=" * 70) + print("%-14s %s" % (k + ':', v), flush=True) + print("=" * 70, flush=True) def main(): |