diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2020-11-08 01:51:30 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2020-11-08 01:51:30 +0100 |
commit | bb82fd136b0b930e3fccdabf8821ac2ad2cbc32e (patch) | |
tree | 64b6a43193b888856eb5ddce12c32bb3cfc3f334 | |
parent | 374878a60cd6f335757fa830a06347070fa39a37 (diff) | |
download | psutil-bb82fd136b0b930e3fccdabf8821ac2ad2cbc32e.tar.gz |
refactor
-rw-r--r-- | psutil/__init__.py | 3 | ||||
-rwxr-xr-x | psutil/tests/test_contracts.py | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/psutil/__init__.py b/psutil/__init__.py index fc844506..fc7f225a 100644 --- a/psutil/__init__.py +++ b/psutil/__init__.py @@ -193,7 +193,8 @@ __all__ = [ __all__.extend(_psplatform.__extra__all__) -if LINUX or FREEBSD: +# Linux, FreeBSD +if hasattr(_psplatform.Process, "rlimit"): # Populate global namespace with RLIM* constants. from . import _psutil_posix diff --git a/psutil/tests/test_contracts.py b/psutil/tests/test_contracts.py index 4e52519d..8a17ff9b 100755 --- a/psutil/tests/test_contracts.py +++ b/psutil/tests/test_contracts.py @@ -88,6 +88,8 @@ class TestAvailConstantsAPIs(PsutilTestCase): ae(hasattr(psutil, "IOPRIO_LOW"), WINDOWS) ae(hasattr(psutil, "IOPRIO_VERYLOW"), WINDOWS) + @unittest.skipIf(GITHUB_WHEELS and LINUX, + "unsupported on GITHUB_WHEELS + LINUX") def test_rlimit(self): ae = self.assertEqual ae(hasattr(psutil, "RLIM_INFINITY"), LINUX or FREEBSD) @@ -110,7 +112,7 @@ class TestAvailConstantsAPIs(PsutilTestCase): ae(hasattr(psutil, "RLIMIT_NICE"), LINUX) if kernel_version() >= (2, 6, 12): ae(hasattr(psutil, "RLIMIT_RTPRIO"), LINUX) - if kernel_version() >= (2, 6, 25) and not GITHUB_WHEELS: + if kernel_version() >= (2, 6, 25): ae(hasattr(psutil, "RLIMIT_RTTIME"), LINUX) if kernel_version() >= (2, 6, 8): ae(hasattr(psutil, "RLIMIT_SIGPENDING"), LINUX) @@ -163,6 +165,8 @@ class TestAvailProcessAPIs(PsutilTestCase): def test_ionice(self): self.assertEqual(hasattr(psutil.Process, "ionice"), LINUX or WINDOWS) + @unittest.skipIf(GITHUB_WHEELS and LINUX, + "unsupported on GITHUB_WHEELS + LINUX") def test_rlimit(self): self.assertEqual(hasattr(psutil.Process, "rlimit"), LINUX or FREEBSD) |