summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-11-08 01:51:30 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2020-11-08 01:51:30 +0100
commitbb82fd136b0b930e3fccdabf8821ac2ad2cbc32e (patch)
tree64b6a43193b888856eb5ddce12c32bb3cfc3f334
parent374878a60cd6f335757fa830a06347070fa39a37 (diff)
downloadpsutil-bb82fd136b0b930e3fccdabf8821ac2ad2cbc32e.tar.gz
refactor
-rw-r--r--psutil/__init__.py3
-rwxr-xr-xpsutil/tests/test_contracts.py6
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)