py2docfx 0.1.20rc2196756__py3-none-any.whl → 0.1.21.dev2246704__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- py2docfx/convert_prepare/get_source.py +1 -1
- py2docfx/convert_prepare/package_info.py +37 -27
- py2docfx/convert_prepare/tests/test_get_source.py +3 -1
- py2docfx/convert_prepare/tests/test_package_info.py +159 -1
- py2docfx/docfx_yaml/build_finished.py +1 -1
- py2docfx/docfx_yaml/logger.py +42 -28
- py2docfx/venv/basevenv/Lib/site-packages/charset_normalizer/api.py +3 -2
- py2docfx/venv/basevenv/Lib/site-packages/charset_normalizer/legacy.py +17 -1
- py2docfx/venv/basevenv/Lib/site-packages/charset_normalizer/version.py +1 -1
- py2docfx/venv/basevenv/Lib/site-packages/requests/__version__.py +2 -2
- py2docfx/venv/basevenv/Lib/site-packages/requests/adapters.py +17 -40
- py2docfx/venv/basevenv/Lib/site-packages/requests/sessions.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/core/_version.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/policies/_authentication.py +21 -9
- py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/policies/_authentication_async.py +21 -9
- py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/policies/_retry.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_bearer_token_provider.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/authorization_code.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/azd_cli.py +82 -17
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/azure_cli.py +28 -5
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/azure_powershell.py +28 -4
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/broker.py +79 -0
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/chained.py +9 -3
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/default.py +153 -53
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/imds.py +25 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/shared_cache.py +12 -5
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/vscode.py +163 -144
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/workload_identity.py +23 -12
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/__init__.py +4 -0
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/interactive.py +14 -2
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/pipeline.py +4 -2
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/utils.py +96 -0
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_version.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_bearer_token_provider.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/authorization_code.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/azd_cli.py +32 -13
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/azure_cli.py +26 -5
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/azure_powershell.py +13 -2
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/chained.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/default.py +120 -55
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/imds.py +27 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/on_behalf_of.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/shared_cache.py +12 -5
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/vscode.py +15 -67
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/workload_identity.py +17 -13
- py2docfx/venv/venv1/Lib/site-packages/cffi/__init__.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/cffi/cparser.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/cffi/recompiler.py +5 -5
- py2docfx/venv/venv1/Lib/site-packages/cffi/setuptools_ext.py +13 -0
- py2docfx/venv/venv1/Lib/site-packages/cffi/vengine_cpy.py +3 -0
- py2docfx/venv/venv1/Lib/site-packages/charset_normalizer/api.py +3 -2
- py2docfx/venv/venv1/Lib/site-packages/charset_normalizer/legacy.py +17 -1
- py2docfx/venv/venv1/Lib/site-packages/charset_normalizer/version.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/cryptography/__about__.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/cryptography/__init__.py +0 -13
- py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/_oid.py +8 -0
- py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/asn1/__init__.py +10 -0
- py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/asn1/asn1.py +116 -0
- py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/backends/openssl/backend.py +3 -9
- py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/declarative_asn1.pyi +32 -0
- py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/openssl/kdf.pyi +23 -0
- py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/x509.pyi +1 -13
- py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/openssl/_conditional.py +16 -0
- py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/openssl/binding.py +16 -1
- py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/primitives/asymmetric/padding.py +0 -2
- py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/primitives/asymmetric/rsa.py +8 -0
- py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/primitives/ciphers/algorithms.py +0 -47
- py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/primitives/kdf/hkdf.py +6 -91
- py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/primitives/kdf/kbkdf.py +1 -3
- py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/primitives/serialization/ssh.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/cryptography/utils.py +0 -2
- py2docfx/venv/venv1/Lib/site-packages/cryptography/x509/name.py +2 -3
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/__init__.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/any_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/api_pb2.py +12 -8
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/compiler/plugin_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/descriptor.py +398 -246
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/descriptor_pb2.py +74 -72
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/descriptor_pool.py +5 -4
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/duration_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/empty_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/field_mask_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/internal/api_implementation.py +0 -6
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/internal/extension_dict.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/internal/field_mask.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/internal/python_edition_defaults.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/internal/python_message.py +10 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/internal/type_checkers.py +47 -5
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/json_format.py +55 -32
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/runtime_version.py +6 -26
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/source_context_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/struct_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/text_format.py +30 -19
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/timestamp_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/type_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/wrappers_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/psutil/__init__.py +39 -19
- py2docfx/venv/venv1/Lib/site-packages/psutil/_common.py +3 -5
- py2docfx/venv/venv1/Lib/site-packages/psutil/_psaix.py +1 -2
- py2docfx/venv/venv1/Lib/site-packages/psutil/_psbsd.py +53 -78
- py2docfx/venv/venv1/Lib/site-packages/psutil/_pslinux.py +55 -38
- py2docfx/venv/venv1/Lib/site-packages/psutil/_psosx.py +40 -12
- py2docfx/venv/venv1/Lib/site-packages/psutil/_psposix.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/psutil/_pssunos.py +1 -2
- py2docfx/venv/venv1/Lib/site-packages/psutil/_pswindows.py +33 -13
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/__init__.py +185 -122
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/__main__.py +2 -3
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_bsd.py +5 -10
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_connections.py +3 -4
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_contracts.py +41 -45
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_linux.py +35 -38
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_memleaks.py +4 -8
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_misc.py +6 -12
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_osx.py +17 -8
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_posix.py +29 -17
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_process.py +74 -75
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_process_all.py +11 -13
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_scripts.py +2 -3
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_sudo.py +117 -0
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_system.py +21 -31
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_testutils.py +23 -23
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_unicode.py +15 -8
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_windows.py +65 -33
- py2docfx/venv/venv1/Lib/site-packages/pycparser/__init__.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/pycparser/c_generator.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/pycparser/c_lexer.py +14 -0
- py2docfx/venv/venv1/Lib/site-packages/pycparser/c_parser.py +30 -7
- py2docfx/venv/venv1/Lib/site-packages/pycparser/lextab.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/pycparser/yacctab.py +132 -127
- py2docfx/venv/venv1/Lib/site-packages/requests/__version__.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/requests/adapters.py +17 -40
- py2docfx/venv/venv1/Lib/site-packages/requests/sessions.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/typing_extensions.py +91 -18
- {py2docfx-0.1.20rc2196756.dist-info → py2docfx-0.1.21.dev2246704.dist-info}/METADATA +1 -1
- {py2docfx-0.1.20rc2196756.dist-info → py2docfx-0.1.21.dev2246704.dist-info}/RECORD +137 -135
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/linux_vscode_adapter.py +0 -100
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/macos_vscode_adapter.py +0 -34
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/win_vscode_adapter.py +0 -77
- {py2docfx-0.1.20rc2196756.dist-info → py2docfx-0.1.21.dev2246704.dist-info}/WHEEL +0 -0
- {py2docfx-0.1.20rc2196756.dist-info → py2docfx-0.1.21.dev2246704.dist-info}/top_level.txt +0 -0
@@ -26,10 +26,9 @@ from psutil.tests import PsutilTestCase
|
|
26
26
|
from psutil.tests import pytest
|
27
27
|
from psutil.tests import retry_on_failure
|
28
28
|
from psutil.tests import sh
|
29
|
-
from psutil.tests import
|
29
|
+
from psutil.tests import spawn_subproc
|
30
30
|
from psutil.tests import terminate
|
31
31
|
|
32
|
-
|
33
32
|
if BSD:
|
34
33
|
from psutil._psutil_posix import getpagesize
|
35
34
|
|
@@ -78,7 +77,7 @@ class BSDTestCase(PsutilTestCase):
|
|
78
77
|
|
79
78
|
@classmethod
|
80
79
|
def setUpClass(cls):
|
81
|
-
cls.pid =
|
80
|
+
cls.pid = spawn_subproc().pid
|
82
81
|
|
83
82
|
@classmethod
|
84
83
|
def tearDownClass(cls):
|
@@ -117,9 +116,9 @@ class BSDTestCase(PsutilTestCase):
|
|
117
116
|
assert usage.total == total
|
118
117
|
# 10 MB tolerance
|
119
118
|
if abs(usage.free - free) > 10 * 1024 * 1024:
|
120
|
-
raise
|
119
|
+
raise pytest.fail(f"psutil={usage.free}, df={free}")
|
121
120
|
if abs(usage.used - used) > 10 * 1024 * 1024:
|
122
|
-
raise
|
121
|
+
raise pytest.fail(f"psutil={usage.used}, df={used}")
|
123
122
|
|
124
123
|
@pytest.mark.skipif(
|
125
124
|
not shutil.which("sysctl"), reason="sysctl cmd not available"
|
@@ -162,7 +161,7 @@ class BSDTestCase(PsutilTestCase):
|
|
162
161
|
class FreeBSDPsutilTestCase(PsutilTestCase):
|
163
162
|
@classmethod
|
164
163
|
def setUpClass(cls):
|
165
|
-
cls.pid =
|
164
|
+
cls.pid = spawn_subproc().pid
|
166
165
|
|
167
166
|
@classmethod
|
168
167
|
def tearDownClass(cls):
|
@@ -389,10 +388,6 @@ class FreeBSDSystemTestCase(PsutilTestCase):
|
|
389
388
|
< 200000
|
390
389
|
)
|
391
390
|
|
392
|
-
# def test_cpu_stats_traps(self):
|
393
|
-
# self.assertAlmostEqual(psutil.cpu_stats().traps,
|
394
|
-
# sysctl('vm.stats.sys.v_trap'), delta=1000)
|
395
|
-
|
396
391
|
# --- swap memory
|
397
392
|
|
398
393
|
def test_swapmem_free(self):
|
@@ -42,7 +42,6 @@ from psutil.tests import tcp_socketpair
|
|
42
42
|
from psutil.tests import unix_socketpair
|
43
43
|
from psutil.tests import wait_for_file
|
44
44
|
|
45
|
-
|
46
45
|
SOCK_SEQPACKET = getattr(socket, "SOCK_SEQPACKET", object())
|
47
46
|
|
48
47
|
|
@@ -204,7 +203,7 @@ class TestConnectedSocket(ConnectionTestCase):
|
|
204
203
|
|
205
204
|
# On SunOS, even after we close() it, the server socket stays around
|
206
205
|
# in TIME_WAIT state.
|
207
|
-
@pytest.mark.skipif(SUNOS, reason="unreliable on
|
206
|
+
@pytest.mark.skipif(SUNOS, reason="unreliable on SUNOS")
|
208
207
|
def test_tcp(self):
|
209
208
|
addr = ("127.0.0.1", 0)
|
210
209
|
assert this_proc_net_connections(kind='tcp4') == []
|
@@ -218,8 +217,8 @@ class TestConnectedSocket(ConnectionTestCase):
|
|
218
217
|
# commenteed.
|
219
218
|
# client.close()
|
220
219
|
# cons = this_proc_net_connections(kind='all')
|
221
|
-
#
|
222
|
-
#
|
220
|
+
# assert len(cons) == 1
|
221
|
+
# assert cons[0].status == psutil.CONN_CLOSE_WAIT
|
223
222
|
finally:
|
224
223
|
server.close()
|
225
224
|
client.close()
|
@@ -9,7 +9,6 @@ returned types and APIs availability.
|
|
9
9
|
Some of these are duplicates of tests test_system.py and test_process.py.
|
10
10
|
"""
|
11
11
|
|
12
|
-
import platform
|
13
12
|
import signal
|
14
13
|
|
15
14
|
import psutil
|
@@ -22,6 +21,7 @@ from psutil import OPENBSD
|
|
22
21
|
from psutil import POSIX
|
23
22
|
from psutil import SUNOS
|
24
23
|
from psutil import WINDOWS
|
24
|
+
from psutil.tests import AARCH64
|
25
25
|
from psutil.tests import GITHUB_ACTIONS
|
26
26
|
from psutil.tests import HAS_CPU_FREQ
|
27
27
|
from psutil.tests import HAS_NET_IO_COUNTERS
|
@@ -35,7 +35,6 @@ from psutil.tests import is_namedtuple
|
|
35
35
|
from psutil.tests import kernel_version
|
36
36
|
from psutil.tests import pytest
|
37
37
|
|
38
|
-
|
39
38
|
# ===================================================================
|
40
39
|
# --- APIs availability
|
41
40
|
# ===================================================================
|
@@ -49,62 +48,58 @@ class TestAvailConstantsAPIs(PsutilTestCase):
|
|
49
48
|
assert hasattr(psutil, "PROCFS_PATH") == (LINUX or SUNOS or AIX)
|
50
49
|
|
51
50
|
def test_win_priority(self):
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
ae(hasattr(psutil, "REALTIME_PRIORITY_CLASS"), WINDOWS)
|
51
|
+
assert hasattr(psutil, "ABOVE_NORMAL_PRIORITY_CLASS") == WINDOWS
|
52
|
+
assert hasattr(psutil, "BELOW_NORMAL_PRIORITY_CLASS") == WINDOWS
|
53
|
+
assert hasattr(psutil, "HIGH_PRIORITY_CLASS") == WINDOWS
|
54
|
+
assert hasattr(psutil, "IDLE_PRIORITY_CLASS") == WINDOWS
|
55
|
+
assert hasattr(psutil, "NORMAL_PRIORITY_CLASS") == WINDOWS
|
56
|
+
assert hasattr(psutil, "REALTIME_PRIORITY_CLASS") == WINDOWS
|
59
57
|
|
60
58
|
def test_linux_ioprio_linux(self):
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
ae(hasattr(psutil, "IOPRIO_CLASS_IDLE"), LINUX)
|
59
|
+
assert hasattr(psutil, "IOPRIO_CLASS_NONE") == LINUX
|
60
|
+
assert hasattr(psutil, "IOPRIO_CLASS_RT") == LINUX
|
61
|
+
assert hasattr(psutil, "IOPRIO_CLASS_BE") == LINUX
|
62
|
+
assert hasattr(psutil, "IOPRIO_CLASS_IDLE") == LINUX
|
66
63
|
|
67
64
|
def test_linux_ioprio_windows(self):
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
ae(hasattr(psutil, "IOPRIO_VERYLOW"), WINDOWS)
|
65
|
+
assert hasattr(psutil, "IOPRIO_HIGH") == WINDOWS
|
66
|
+
assert hasattr(psutil, "IOPRIO_NORMAL") == WINDOWS
|
67
|
+
assert hasattr(psutil, "IOPRIO_LOW") == WINDOWS
|
68
|
+
assert hasattr(psutil, "IOPRIO_VERYLOW") == WINDOWS
|
73
69
|
|
74
70
|
@pytest.mark.skipif(
|
75
71
|
GITHUB_ACTIONS and LINUX,
|
76
72
|
reason="unsupported on GITHUB_ACTIONS + LINUX",
|
77
73
|
)
|
78
74
|
def test_rlimit(self):
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
ae(hasattr(psutil, "RLIMIT_LOCKS"), LINUX)
|
75
|
+
assert hasattr(psutil, "RLIM_INFINITY") == LINUX or FREEBSD
|
76
|
+
assert hasattr(psutil, "RLIMIT_AS") == LINUX or FREEBSD
|
77
|
+
assert hasattr(psutil, "RLIMIT_CORE") == LINUX or FREEBSD
|
78
|
+
assert hasattr(psutil, "RLIMIT_CPU") == LINUX or FREEBSD
|
79
|
+
assert hasattr(psutil, "RLIMIT_DATA") == LINUX or FREEBSD
|
80
|
+
assert hasattr(psutil, "RLIMIT_FSIZE") == LINUX or FREEBSD
|
81
|
+
assert hasattr(psutil, "RLIMIT_MEMLOCK") == LINUX or FREEBSD
|
82
|
+
assert hasattr(psutil, "RLIMIT_NOFILE") == LINUX or FREEBSD
|
83
|
+
assert hasattr(psutil, "RLIMIT_NPROC") == LINUX or FREEBSD
|
84
|
+
assert hasattr(psutil, "RLIMIT_RSS") == LINUX or FREEBSD
|
85
|
+
assert hasattr(psutil, "RLIMIT_STACK") == LINUX or FREEBSD
|
86
|
+
|
87
|
+
assert hasattr(psutil, "RLIMIT_LOCKS") == LINUX
|
93
88
|
if POSIX:
|
94
89
|
if kernel_version() >= (2, 6, 8):
|
95
|
-
|
90
|
+
assert hasattr(psutil, "RLIMIT_MSGQUEUE") == LINUX
|
96
91
|
if kernel_version() >= (2, 6, 12):
|
97
|
-
|
92
|
+
assert hasattr(psutil, "RLIMIT_NICE") == LINUX
|
98
93
|
if kernel_version() >= (2, 6, 12):
|
99
|
-
|
94
|
+
assert hasattr(psutil, "RLIMIT_RTPRIO") == LINUX
|
100
95
|
if kernel_version() >= (2, 6, 25):
|
101
|
-
|
96
|
+
assert hasattr(psutil, "RLIMIT_RTTIME") == LINUX
|
102
97
|
if kernel_version() >= (2, 6, 8):
|
103
|
-
|
98
|
+
assert hasattr(psutil, "RLIMIT_SIGPENDING") == LINUX
|
104
99
|
|
105
|
-
|
106
|
-
|
107
|
-
|
100
|
+
assert hasattr(psutil, "RLIMIT_SWAP") == FREEBSD
|
101
|
+
assert hasattr(psutil, "RLIMIT_SBSIZE") == FREEBSD
|
102
|
+
assert hasattr(psutil, "RLIMIT_NPTS") == FREEBSD
|
108
103
|
|
109
104
|
|
110
105
|
class TestAvailSystemAPIs(PsutilTestCase):
|
@@ -114,6 +109,7 @@ class TestAvailSystemAPIs(PsutilTestCase):
|
|
114
109
|
def test_win_service_get(self):
|
115
110
|
assert hasattr(psutil, "win_service_get") == WINDOWS
|
116
111
|
|
112
|
+
@pytest.mark.skipif(MACOS and AARCH64, reason="skipped due to #1892")
|
117
113
|
def test_cpu_freq(self):
|
118
114
|
assert hasattr(psutil, "cpu_freq") == (
|
119
115
|
LINUX or MACOS or WINDOWS or FREEBSD or OPENBSD
|
@@ -226,9 +222,7 @@ class TestSystemAPITypes(PsutilTestCase):
|
|
226
222
|
assert isinstance(psutil.cpu_count(), int)
|
227
223
|
|
228
224
|
# TODO: remove this once 1892 is fixed
|
229
|
-
@pytest.mark.skipif(
|
230
|
-
MACOS and platform.machine() == 'arm64', reason="skipped due to #1892"
|
231
|
-
)
|
225
|
+
@pytest.mark.skipif(MACOS and AARCH64, reason="skipped due to #1892")
|
232
226
|
@pytest.mark.skipif(not HAS_CPU_FREQ, reason="not supported")
|
233
227
|
def test_cpu_freq(self):
|
234
228
|
if psutil.cpu_freq() is None:
|
@@ -313,12 +307,14 @@ class TestSystemAPITypes(PsutilTestCase):
|
|
313
307
|
assert isinstance(user.terminal, (str, type(None)))
|
314
308
|
assert isinstance(user.host, (str, type(None)))
|
315
309
|
assert isinstance(user.pid, (int, type(None)))
|
310
|
+
if isinstance(user.pid, int):
|
311
|
+
assert user.pid > 0
|
316
312
|
|
317
313
|
|
318
314
|
class TestProcessWaitType(PsutilTestCase):
|
319
315
|
@pytest.mark.skipif(not POSIX, reason="not POSIX")
|
320
316
|
def test_negative_signal(self):
|
321
|
-
p = psutil.Process(self.
|
317
|
+
p = psutil.Process(self.spawn_subproc().pid)
|
322
318
|
p.terminate()
|
323
319
|
code = p.wait()
|
324
320
|
assert code == -signal.SIGTERM
|
@@ -31,8 +31,7 @@ from psutil.tests import HAS_BATTERY
|
|
31
31
|
from psutil.tests import HAS_CPU_FREQ
|
32
32
|
from psutil.tests import HAS_GETLOADAVG
|
33
33
|
from psutil.tests import HAS_RLIMIT
|
34
|
-
from psutil.tests import
|
35
|
-
from psutil.tests import PYTEST_PARALLEL
|
34
|
+
from psutil.tests import RISCV64
|
36
35
|
from psutil.tests import TOLERANCE_DISK_USAGE
|
37
36
|
from psutil.tests import TOLERANCE_SYS_MEM
|
38
37
|
from psutil.tests import PsutilTestCase
|
@@ -45,7 +44,6 @@ from psutil.tests import safe_rmpath
|
|
45
44
|
from psutil.tests import sh
|
46
45
|
from psutil.tests import skip_on_not_implemented
|
47
46
|
|
48
|
-
|
49
47
|
if LINUX:
|
50
48
|
from psutil._pslinux import CLOCK_TICKS
|
51
49
|
from psutil._pslinux import RootFsDeviceFinder
|
@@ -243,10 +241,8 @@ class TestSystemVirtualMemoryAgainstFree(PsutilTestCase):
|
|
243
241
|
# memory.
|
244
242
|
# https://gitlab.com/procps-ng/procps/commit/
|
245
243
|
# 2184e90d2e7cdb582f9a5b706b47015e56707e4d
|
246
|
-
if get_free_version_info() < (
|
244
|
+
if get_free_version_info() < (4, 0, 0):
|
247
245
|
raise pytest.skip("free version too old")
|
248
|
-
if get_free_version_info() >= (4, 0, 0):
|
249
|
-
raise pytest.skip("free version too recent")
|
250
246
|
cli_value = free_physmem().used
|
251
247
|
psutil_value = psutil.virtual_memory().used
|
252
248
|
assert abs(cli_value - psutil_value) < TOLERANCE_SYS_MEM
|
@@ -298,10 +294,8 @@ class TestSystemVirtualMemoryAgainstVmstat(PsutilTestCase):
|
|
298
294
|
# memory.
|
299
295
|
# https://gitlab.com/procps-ng/procps/commit/
|
300
296
|
# 2184e90d2e7cdb582f9a5b706b47015e56707e4d
|
301
|
-
if get_free_version_info() < (
|
297
|
+
if get_free_version_info() < (4, 0, 0):
|
302
298
|
raise pytest.skip("free version too old")
|
303
|
-
if get_free_version_info() >= (4, 0, 0):
|
304
|
-
raise pytest.skip("free version too recent")
|
305
299
|
vmstat_value = vmstat('used memory') * 1024
|
306
300
|
psutil_value = psutil.virtual_memory().used
|
307
301
|
assert abs(vmstat_value - psutil_value) < TOLERANCE_SYS_MEM
|
@@ -776,7 +770,8 @@ class TestSystemCPUFrequency(PsutilTestCase):
|
|
776
770
|
|
777
771
|
@pytest.mark.skipif(not HAS_CPU_FREQ, reason="not supported")
|
778
772
|
@pytest.mark.skipif(
|
779
|
-
AARCH64
|
773
|
+
AARCH64 or RISCV64,
|
774
|
+
reason=f"{platform.machine()} does not report mhz in /proc/cpuinfo",
|
780
775
|
)
|
781
776
|
def test_emulate_use_cpuinfo(self):
|
782
777
|
# Emulate a case where /sys/devices/system/cpu/cpufreq* does not
|
@@ -915,7 +910,7 @@ class TestSystemCPUStats(PsutilTestCase):
|
|
915
910
|
# def test_ctx_switches(self):
|
916
911
|
# vmstat_value = vmstat("context switches")
|
917
912
|
# psutil_value = psutil.cpu_stats().ctx_switches
|
918
|
-
#
|
913
|
+
# assert abs(vmstat_value - psutil_value) < 500
|
919
914
|
|
920
915
|
def test_interrupts(self):
|
921
916
|
vmstat_value = vmstat("interrupts")
|
@@ -977,9 +972,8 @@ class TestSystemNetIfAddrs(PsutilTestCase):
|
|
977
972
|
# if re.search(r"^\d+:", line):
|
978
973
|
# found += 1
|
979
974
|
# name = line.split(':')[1].strip()
|
980
|
-
#
|
981
|
-
#
|
982
|
-
# pprint.pformat(nics), out))
|
975
|
+
# assert name in nics
|
976
|
+
# assert len(nics) == found
|
983
977
|
|
984
978
|
|
985
979
|
@pytest.mark.skipif(not LINUX, reason="LINUX only")
|
@@ -1034,7 +1028,7 @@ class TestSystemNetIfStats(PsutilTestCase):
|
|
1034
1028
|
assert ifconfig_flags == psutil_flags
|
1035
1029
|
|
1036
1030
|
if not matches_found:
|
1037
|
-
raise
|
1031
|
+
raise pytest.fail("no matches were found")
|
1038
1032
|
|
1039
1033
|
|
1040
1034
|
@pytest.mark.skipif(not LINUX, reason="LINUX only")
|
@@ -1095,13 +1089,12 @@ class TestSystemNetConnections(PsutilTestCase):
|
|
1095
1089
|
@mock.patch('psutil._pslinux.supports_ipv6', return_value=False)
|
1096
1090
|
def test_emulate_ipv6_unsupported(self, supports_ipv6, inet_ntop):
|
1097
1091
|
# see: https://github.com/giampaolo/psutil/issues/623
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
psutil.net_connections(kind='inet6')
|
1092
|
+
with socket.socket(socket.AF_INET6, socket.SOCK_STREAM) as s:
|
1093
|
+
try:
|
1094
|
+
s.bind(("::1", 0))
|
1095
|
+
except OSError:
|
1096
|
+
pass
|
1097
|
+
psutil.net_connections(kind='inet6')
|
1105
1098
|
|
1106
1099
|
def test_emulate_unix(self):
|
1107
1100
|
content = textwrap.dedent("""\
|
@@ -1525,14 +1518,12 @@ class TestMisc(PsutilTestCase):
|
|
1525
1518
|
psutil.cpu_times(percpu=True)
|
1526
1519
|
with pytest.raises(OSError):
|
1527
1520
|
psutil.boot_time()
|
1528
|
-
# self.assertRaises(OSError, psutil.pids)
|
1529
1521
|
with pytest.raises(OSError):
|
1530
1522
|
psutil.net_connections()
|
1531
1523
|
with pytest.raises(OSError):
|
1532
1524
|
psutil.net_io_counters()
|
1533
1525
|
with pytest.raises(OSError):
|
1534
1526
|
psutil.net_if_stats()
|
1535
|
-
# self.assertRaises(OSError, psutil.disk_io_counters)
|
1536
1527
|
with pytest.raises(OSError):
|
1537
1528
|
psutil.disk_partitions()
|
1538
1529
|
with pytest.raises(psutil.NoSuchProcess):
|
@@ -1541,17 +1532,19 @@ class TestMisc(PsutilTestCase):
|
|
1541
1532
|
psutil.PROCFS_PATH = "/proc"
|
1542
1533
|
|
1543
1534
|
@retry_on_failure()
|
1544
|
-
@pytest.mark.
|
1535
|
+
@pytest.mark.xdist_group(name="serial")
|
1545
1536
|
def test_issue_687(self):
|
1546
1537
|
# In case of thread ID:
|
1547
1538
|
# - pid_exists() is supposed to return False
|
1548
1539
|
# - Process(tid) is supposed to work
|
1549
1540
|
# - pids() should not return the TID
|
1550
1541
|
# See: https://github.com/giampaolo/psutil/issues/687
|
1542
|
+
|
1543
|
+
p = psutil.Process()
|
1544
|
+
nthreads = len(p.threads())
|
1551
1545
|
with ThreadTask():
|
1552
|
-
p = psutil.Process()
|
1553
1546
|
threads = p.threads()
|
1554
|
-
assert len(threads) ==
|
1547
|
+
assert len(threads) == nthreads + 1
|
1555
1548
|
tid = sorted(threads, key=lambda x: x.id)[1].id
|
1556
1549
|
assert p.pid != tid
|
1557
1550
|
pt = psutil.Process(tid)
|
@@ -1824,7 +1817,7 @@ class TestSensorsFans(PsutilTestCase):
|
|
1824
1817
|
class TestProcess(PsutilTestCase):
|
1825
1818
|
@retry_on_failure()
|
1826
1819
|
def test_parse_smaps_vs_memory_maps(self):
|
1827
|
-
sproc = self.
|
1820
|
+
sproc = self.spawn_subproc()
|
1828
1821
|
uss, pss, swap = psutil._pslinux.Process(sproc.pid)._parse_smaps()
|
1829
1822
|
maps = psutil.Process(sproc.pid).memory_maps(grouped=False)
|
1830
1823
|
assert (
|
@@ -1867,8 +1860,6 @@ class TestProcess(PsutilTestCase):
|
|
1867
1860
|
assert pss == 3 * 1024
|
1868
1861
|
assert swap == 15 * 1024
|
1869
1862
|
|
1870
|
-
# On PYPY file descriptors are not closed fast enough.
|
1871
|
-
@pytest.mark.skipif(PYPY, reason="unreliable on PYPY")
|
1872
1863
|
def test_open_files_mode(self):
|
1873
1864
|
def get_test_file(fname):
|
1874
1865
|
p = psutil.Process()
|
@@ -1966,14 +1957,6 @@ class TestProcess(PsutilTestCase):
|
|
1966
1957
|
assert psutil._pslinux.Process(os.getpid()).terminal() is None
|
1967
1958
|
assert m.called
|
1968
1959
|
|
1969
|
-
# TODO: re-enable this test.
|
1970
|
-
# def test_num_ctx_switches_mocked(self):
|
1971
|
-
# with mock.patch('psutil._common.open', create=True) as m:
|
1972
|
-
# self.assertRaises(
|
1973
|
-
# NotImplementedError,
|
1974
|
-
# psutil._pslinux.Process(os.getpid()).num_ctx_switches)
|
1975
|
-
# assert m.called
|
1976
|
-
|
1977
1960
|
def test_cmdline_mocked(self):
|
1978
1961
|
# see: https://github.com/giampaolo/psutil/issues/639
|
1979
1962
|
p = psutil.Process()
|
@@ -2063,6 +2046,15 @@ class TestProcess(PsutilTestCase):
|
|
2063
2046
|
assert m.called
|
2064
2047
|
assert ret == ""
|
2065
2048
|
|
2049
|
+
def test_cwd_mocked(self):
|
2050
|
+
# https://github.com/giampaolo/psutil/issues/2514
|
2051
|
+
with mock.patch(
|
2052
|
+
'psutil._pslinux.readlink', side_effect=FileNotFoundError
|
2053
|
+
) as m:
|
2054
|
+
ret = psutil.Process().cwd()
|
2055
|
+
assert m.called
|
2056
|
+
assert ret == ""
|
2057
|
+
|
2066
2058
|
def test_issue_1014(self):
|
2067
2059
|
# Emulates a case where smaps file does not exist. In this case
|
2068
2060
|
# wrap_exception decorator should not raise NoSuchProcess.
|
@@ -2200,6 +2192,11 @@ class TestProcess(PsutilTestCase):
|
|
2200
2192
|
assert p.net_connections() == []
|
2201
2193
|
assert m.called
|
2202
2194
|
|
2195
|
+
def test_create_time_monotonic(self):
|
2196
|
+
p = psutil.Process()
|
2197
|
+
assert p._proc.create_time() != p._proc.create_time(monotonic=True)
|
2198
|
+
assert p._get_ident()[1] == p._proc.create_time(monotonic=True)
|
2199
|
+
|
2203
2200
|
|
2204
2201
|
@pytest.mark.skipif(not LINUX, reason="LINUX only")
|
2205
2202
|
class TestProcessAgainstStatus(PsutilTestCase):
|
@@ -14,10 +14,8 @@ PyPy appears to be completely unstable for this framework, probably
|
|
14
14
|
because of how its JIT handles memory, so tests are skipped.
|
15
15
|
"""
|
16
16
|
|
17
|
-
|
18
17
|
import functools
|
19
18
|
import os
|
20
|
-
import platform
|
21
19
|
|
22
20
|
import psutil
|
23
21
|
import psutil._common
|
@@ -27,6 +25,7 @@ from psutil import OPENBSD
|
|
27
25
|
from psutil import POSIX
|
28
26
|
from psutil import SUNOS
|
29
27
|
from psutil import WINDOWS
|
28
|
+
from psutil.tests import AARCH64
|
30
29
|
from psutil.tests import HAS_CPU_AFFINITY
|
31
30
|
from psutil.tests import HAS_CPU_FREQ
|
32
31
|
from psutil.tests import HAS_ENVIRON
|
@@ -45,11 +44,10 @@ from psutil.tests import get_testfn
|
|
45
44
|
from psutil.tests import process_namespace
|
46
45
|
from psutil.tests import pytest
|
47
46
|
from psutil.tests import skip_on_access_denied
|
48
|
-
from psutil.tests import
|
47
|
+
from psutil.tests import spawn_subproc
|
49
48
|
from psutil.tests import system_namespace
|
50
49
|
from psutil.tests import terminate
|
51
50
|
|
52
|
-
|
53
51
|
cext = psutil._psplatform.cext
|
54
52
|
thisproc = psutil.Process()
|
55
53
|
FEW_TIMES = 5
|
@@ -274,7 +272,7 @@ class TestTerminatedProcessLeaks(TestProcessObjectLeaks):
|
|
274
272
|
@classmethod
|
275
273
|
def setUpClass(cls):
|
276
274
|
super().setUpClass()
|
277
|
-
cls.subp =
|
275
|
+
cls.subp = spawn_subproc()
|
278
276
|
cls.proc = psutil.Process(cls.subp.pid)
|
279
277
|
cls.proc.kill()
|
280
278
|
cls.proc.wait()
|
@@ -363,9 +361,7 @@ class TestModuleFunctionsLeaks(TestMemoryLeak):
|
|
363
361
|
|
364
362
|
@fewtimes_if_linux()
|
365
363
|
# TODO: remove this once 1892 is fixed
|
366
|
-
@pytest.mark.skipif(
|
367
|
-
MACOS and platform.machine() == 'arm64', reason="skipped due to #1892"
|
368
|
-
)
|
364
|
+
@pytest.mark.skipif(MACOS and AARCH64, reason="skipped due to #1892")
|
369
365
|
@pytest.mark.skipif(not HAS_CPU_FREQ, reason="not supported")
|
370
366
|
def test_cpu_freq(self):
|
371
367
|
self.execute(psutil.cpu_freq)
|
@@ -35,7 +35,6 @@ from psutil.tests import pytest
|
|
35
35
|
from psutil.tests import reload_module
|
36
36
|
from psutil.tests import system_namespace
|
37
37
|
|
38
|
-
|
39
38
|
# ===================================================================
|
40
39
|
# --- Test classes' repr(), str(), ...
|
41
40
|
# ===================================================================
|
@@ -49,7 +48,7 @@ class TestSpecialMethods(PsutilTestCase):
|
|
49
48
|
psutil.Process(2**128)
|
50
49
|
|
51
50
|
def test_process__repr__(self, func=repr):
|
52
|
-
p = psutil.Process(self.
|
51
|
+
p = psutil.Process(self.spawn_subproc().pid)
|
53
52
|
r = func(p)
|
54
53
|
assert "psutil.Process" in r
|
55
54
|
assert f"pid={p.pid}" in r
|
@@ -218,7 +217,9 @@ class TestMisc(PsutilTestCase):
|
|
218
217
|
fun.__doc__ is not None
|
219
218
|
and 'deprecated' not in fun.__doc__.lower()
|
220
219
|
):
|
221
|
-
raise
|
220
|
+
raise pytest.fail(
|
221
|
+
f"{name!r} not in psutil.__all__"
|
222
|
+
)
|
222
223
|
|
223
224
|
# Import 'star' will break if __all__ is inconsistent, see:
|
224
225
|
# https://github.com/giampaolo/psutil/issues/656
|
@@ -254,7 +255,7 @@ class TestMisc(PsutilTestCase):
|
|
254
255
|
|
255
256
|
ns = process_namespace(proc)
|
256
257
|
for fun, name in ns.iter(ns.getters, clear_cache=True):
|
257
|
-
with self.subTest(proc=proc, name=name):
|
258
|
+
with self.subTest(proc=str(proc), name=name):
|
258
259
|
try:
|
259
260
|
ret = fun()
|
260
261
|
except psutil.Error:
|
@@ -342,7 +343,7 @@ class TestMisc(PsutilTestCase):
|
|
342
343
|
with mock.patch.object(
|
343
344
|
psutil.Process, '_get_ident', side_effect=psutil.NoSuchProcess(1)
|
344
345
|
) as meth:
|
345
|
-
with
|
346
|
+
with pytest.raises(psutil.NoSuchProcess):
|
346
347
|
psutil.Process()
|
347
348
|
assert meth.called
|
348
349
|
|
@@ -545,35 +546,28 @@ class TestCommonModule(PsutilTestCase):
|
|
545
546
|
assert parse_environ_block("a=1\0b=2") == {k("a"): "1"}
|
546
547
|
|
547
548
|
def test_supports_ipv6(self):
|
548
|
-
self.addCleanup(supports_ipv6.cache_clear)
|
549
549
|
if supports_ipv6():
|
550
550
|
with mock.patch('psutil._common.socket') as s:
|
551
551
|
s.has_ipv6 = False
|
552
|
-
supports_ipv6.cache_clear()
|
553
552
|
assert not supports_ipv6()
|
554
553
|
|
555
|
-
supports_ipv6.cache_clear()
|
556
554
|
with mock.patch(
|
557
555
|
'psutil._common.socket.socket', side_effect=OSError
|
558
556
|
) as s:
|
559
557
|
assert not supports_ipv6()
|
560
558
|
assert s.called
|
561
559
|
|
562
|
-
supports_ipv6.cache_clear()
|
563
560
|
with mock.patch(
|
564
561
|
'psutil._common.socket.socket', side_effect=socket.gaierror
|
565
562
|
) as s:
|
566
563
|
assert not supports_ipv6()
|
567
|
-
supports_ipv6.cache_clear()
|
568
564
|
assert s.called
|
569
565
|
|
570
|
-
supports_ipv6.cache_clear()
|
571
566
|
with mock.patch(
|
572
567
|
'psutil._common.socket.socket.bind',
|
573
568
|
side_effect=socket.gaierror,
|
574
569
|
) as s:
|
575
570
|
assert not supports_ipv6()
|
576
|
-
supports_ipv6.cache_clear()
|
577
571
|
assert s.called
|
578
572
|
else:
|
579
573
|
with pytest.raises(OSError):
|
@@ -6,13 +6,13 @@
|
|
6
6
|
|
7
7
|
"""macOS specific tests."""
|
8
8
|
|
9
|
-
import platform
|
10
9
|
import re
|
11
10
|
import time
|
12
11
|
|
13
12
|
import psutil
|
14
13
|
from psutil import MACOS
|
15
14
|
from psutil import POSIX
|
15
|
+
from psutil.tests import AARCH64
|
16
16
|
from psutil.tests import CI_TESTING
|
17
17
|
from psutil.tests import HAS_BATTERY
|
18
18
|
from psutil.tests import TOLERANCE_DISK_USAGE
|
@@ -21,10 +21,9 @@ from psutil.tests import PsutilTestCase
|
|
21
21
|
from psutil.tests import pytest
|
22
22
|
from psutil.tests import retry_on_failure
|
23
23
|
from psutil.tests import sh
|
24
|
-
from psutil.tests import
|
24
|
+
from psutil.tests import spawn_subproc
|
25
25
|
from psutil.tests import terminate
|
26
26
|
|
27
|
-
|
28
27
|
if POSIX:
|
29
28
|
from psutil._psutil_posix import getpagesize
|
30
29
|
|
@@ -56,7 +55,7 @@ def vm_stat(field):
|
|
56
55
|
class TestProcess(PsutilTestCase):
|
57
56
|
@classmethod
|
58
57
|
def setUpClass(cls):
|
59
|
-
cls.pid =
|
58
|
+
cls.pid = spawn_subproc().pid
|
60
59
|
|
61
60
|
@classmethod
|
62
61
|
def tearDownClass(cls):
|
@@ -115,9 +114,7 @@ class TestSystemAPIs(PsutilTestCase):
|
|
115
114
|
assert num == psutil.cpu_count(logical=False)
|
116
115
|
|
117
116
|
# TODO: remove this once 1892 is fixed
|
118
|
-
@pytest.mark.skipif(
|
119
|
-
MACOS and platform.machine() == 'arm64', reason="skipped due to #1892"
|
120
|
-
)
|
117
|
+
@pytest.mark.skipif(MACOS and AARCH64, reason="skipped due to #1892")
|
121
118
|
def test_cpu_freq(self):
|
122
119
|
freq = psutil.cpu_freq()
|
123
120
|
assert freq.current * 1000 * 1000 == sysctl("sysctl hw.cpufrequency")
|
@@ -131,7 +128,7 @@ class TestSystemAPIs(PsutilTestCase):
|
|
131
128
|
assert sysctl_hwphymem == psutil.virtual_memory().total
|
132
129
|
|
133
130
|
@pytest.mark.skipif(
|
134
|
-
CI_TESTING and MACOS and
|
131
|
+
CI_TESTING and MACOS and AARCH64,
|
135
132
|
reason="skipped on MACOS + ARM64 + CI_TESTING",
|
136
133
|
)
|
137
134
|
@retry_on_failure()
|
@@ -140,6 +137,10 @@ class TestSystemAPIs(PsutilTestCase):
|
|
140
137
|
psutil_val = psutil.virtual_memory().free
|
141
138
|
assert abs(psutil_val - vmstat_val) < TOLERANCE_SYS_MEM
|
142
139
|
|
140
|
+
@pytest.mark.skipif(
|
141
|
+
CI_TESTING and MACOS and AARCH64,
|
142
|
+
reason="skipped on MACOS + ARM64 + CI_TESTING",
|
143
|
+
)
|
143
144
|
@retry_on_failure()
|
144
145
|
def test_vmem_active(self):
|
145
146
|
vmstat_val = vm_stat("active")
|
@@ -195,3 +196,11 @@ class TestSystemAPIs(PsutilTestCase):
|
|
195
196
|
psutil_result = psutil.sensors_battery()
|
196
197
|
assert psutil_result.power_plugged == power_plugged
|
197
198
|
assert psutil_result.percent == int(percent)
|
199
|
+
|
200
|
+
# --- others
|
201
|
+
|
202
|
+
def test_boot_time(self):
|
203
|
+
out = sh('sysctl kern.boottime')
|
204
|
+
a = float(re.search(r"sec\s*=\s*(\d+)", out).groups(0)[0])
|
205
|
+
b = psutil.boot_time()
|
206
|
+
assert a == b
|