py2docfx 0.1.11rc1981066__py3-none-any.whl → 0.1.11rc1997820__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/__main__.py +24 -15
- py2docfx/convert_prepare/environment.py +13 -10
- py2docfx/convert_prepare/generate_document.py +6 -6
- py2docfx/convert_prepare/get_source.py +7 -7
- py2docfx/convert_prepare/git.py +10 -13
- py2docfx/convert_prepare/install_package.py +2 -2
- py2docfx/convert_prepare/pack.py +7 -10
- py2docfx/convert_prepare/package_info.py +3 -3
- py2docfx/convert_prepare/pip_utils.py +12 -14
- py2docfx/convert_prepare/post_process/merge_toc.py +3 -2
- py2docfx/convert_prepare/sphinx_caller.py +34 -12
- py2docfx/convert_prepare/tests/test_environment.py +0 -3
- py2docfx/convert_prepare/tests/test_generate_document.py +4 -2
- py2docfx/convert_prepare/tests/test_get_source.py +22 -14
- py2docfx/convert_prepare/tests/test_pack.py +6 -3
- py2docfx/convert_prepare/tests/test_params.py +0 -1
- py2docfx/convert_prepare/tests/test_sphinx_caller.py +10 -8
- py2docfx/convert_prepare/tests/test_subpackage.py +1 -0
- py2docfx/docfx_yaml/build_finished.py +1 -1
- py2docfx/docfx_yaml/logger.py +56 -55
- 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 +20 -14
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/azure_arc.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/azure_cli.py +36 -14
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/azure_powershell.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/chained.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/default.py +4 -3
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/imds.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/managed_identity.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/__init__.py +2 -0
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/auth_code_redirect_handler.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/decorators.py +15 -7
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/interactive.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/managed_identity_client.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/msal_client.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/msal_managed_identity_client.py +2 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/shared_token_cache.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/utils.py +17 -2
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_version.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/azd_cli.py +14 -11
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/azure_cli.py +30 -12
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/default.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/imds.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/managed_identity.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_internal/decorators.py +15 -7
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_internal/managed_identity_client.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/cryptography/__about__.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/google/api/annotations_pb2.py +7 -4
- py2docfx/venv/venv1/Lib/site-packages/google/api/auth_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/api/backend_pb2.py +14 -7
- py2docfx/venv/venv1/Lib/site-packages/google/api/billing_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/api/client_pb2.py +47 -38
- py2docfx/venv/venv1/Lib/site-packages/google/api/config_change_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/api/consumer_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/api/context_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/api/control_pb2.py +6 -4
- py2docfx/venv/venv1/Lib/site-packages/google/api/distribution_pb2.py +7 -5
- py2docfx/venv/venv1/Lib/site-packages/google/api/documentation_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/api/endpoint_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/api/error_reason_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/api/field_behavior_pb2.py +8 -6
- py2docfx/venv/venv1/Lib/site-packages/google/api/field_info_pb2.py +6 -4
- py2docfx/venv/venv1/Lib/site-packages/google/api/http_pb2.py +7 -4
- py2docfx/venv/venv1/Lib/site-packages/google/api/httpbody_pb2.py +6 -4
- py2docfx/venv/venv1/Lib/site-packages/google/api/label_pb2.py +7 -4
- py2docfx/venv/venv1/Lib/site-packages/google/api/launch_stage_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/api/log_pb2.py +6 -4
- py2docfx/venv/venv1/Lib/site-packages/google/api/logging_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/api/metric_pb2.py +12 -9
- py2docfx/venv/venv1/Lib/site-packages/google/api/monitored_resource_pb2.py +15 -10
- py2docfx/venv/venv1/Lib/site-packages/google/api/monitoring_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/api/policy_pb2.py +7 -5
- py2docfx/venv/venv1/Lib/site-packages/google/api/quota_pb2.py +10 -7
- py2docfx/venv/venv1/Lib/site-packages/google/api/resource_pb2.py +7 -5
- py2docfx/venv/venv1/Lib/site-packages/google/api/routing_pb2.py +6 -4
- py2docfx/venv/venv1/Lib/site-packages/google/api/service_pb2.py +15 -12
- py2docfx/venv/venv1/Lib/site-packages/google/api/source_info_pb2.py +6 -4
- py2docfx/venv/venv1/Lib/site-packages/google/api/system_parameter_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/api/usage_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/api/visibility_pb2.py +7 -5
- py2docfx/venv/venv1/Lib/site-packages/google/cloud/extended_operations_pb2.py +6 -4
- py2docfx/venv/venv1/Lib/site-packages/google/cloud/location/locations_pb2.py +18 -13
- py2docfx/venv/venv1/Lib/site-packages/google/gapic/metadata/gapic_metadata_pb2.py +31 -26
- py2docfx/venv/venv1/Lib/site-packages/google/logging/type/http_request_pb2.py +6 -4
- py2docfx/venv/venv1/Lib/site-packages/google/logging/type/log_severity_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/longrunning/operations_grpc.py +2 -1
- py2docfx/venv/venv1/Lib/site-packages/google/longrunning/operations_grpc_pb2.py +11 -10
- py2docfx/venv/venv1/Lib/site-packages/google/longrunning/operations_pb2.py +20 -17
- py2docfx/venv/venv1/Lib/site-packages/google/longrunning/operations_pb2_grpc.py +1 -2
- py2docfx/venv/venv1/Lib/site-packages/google/longrunning/operations_proto.py +2 -1
- py2docfx/venv/venv1/Lib/site-packages/google/longrunning/operations_proto_pb2.py +22 -19
- py2docfx/venv/venv1/Lib/site-packages/google/rpc/code_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/rpc/context/attribute_context_pb2.py +20 -16
- py2docfx/venv/venv1/Lib/site-packages/google/rpc/context/audit_context_pb2.py +7 -5
- py2docfx/venv/venv1/Lib/site-packages/google/rpc/error_details_pb2.py +21 -19
- py2docfx/venv/venv1/Lib/site-packages/google/rpc/http_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/rpc/status_pb2.py +6 -4
- py2docfx/venv/venv1/Lib/site-packages/google/type/calendar_period_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/type/color_pb2.py +6 -4
- py2docfx/venv/venv1/Lib/site-packages/google/type/date_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/type/datetime_pb2.py +6 -4
- py2docfx/venv/venv1/Lib/site-packages/google/type/dayofweek_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/type/decimal_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/type/expr_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/type/fraction_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/type/interval_pb2.py +6 -4
- py2docfx/venv/venv1/Lib/site-packages/google/type/latlng_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/type/localized_text_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/type/money_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/type/month_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/type/phone_number_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/type/postal_address_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/type/quaternion_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/google/type/timeofday_pb2.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/psutil/__init__.py +122 -201
- py2docfx/venv/venv1/Lib/site-packages/psutil/_common.py +84 -128
- py2docfx/venv/venv1/Lib/site-packages/psutil/_psaix.py +24 -38
- py2docfx/venv/venv1/Lib/site-packages/psutil/_psbsd.py +44 -58
- py2docfx/venv/venv1/Lib/site-packages/psutil/_pslinux.py +170 -254
- py2docfx/venv/venv1/Lib/site-packages/psutil/_psosx.py +8 -16
- py2docfx/venv/venv1/Lib/site-packages/psutil/_psposix.py +13 -49
- py2docfx/venv/venv1/Lib/site-packages/psutil/_pssunos.py +41 -60
- py2docfx/venv/venv1/Lib/site-packages/psutil/_pswindows.py +75 -145
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/__init__.py +105 -193
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_aix.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_bsd.py +27 -26
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_connections.py +16 -17
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_contracts.py +5 -19
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_linux.py +153 -211
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_memleaks.py +0 -6
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_misc.py +22 -207
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_osx.py +9 -4
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_posix.py +8 -15
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_process.py +104 -184
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_process_all.py +28 -36
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_scripts.py +240 -0
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_sunos.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_system.py +44 -50
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_testutils.py +23 -33
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_unicode.py +8 -67
- py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_windows.py +32 -52
- {py2docfx-0.1.11rc1981066.dist-info → py2docfx-0.1.11rc1997820.dist-info}/METADATA +1 -1
- {py2docfx-0.1.11rc1981066.dist-info → py2docfx-0.1.11rc1997820.dist-info}/RECORD +145 -145
- py2docfx/venv/venv1/Lib/site-packages/psutil/_compat.py +0 -477
- {py2docfx-0.1.11rc1981066.dist-info → py2docfx-0.1.11rc1997820.dist-info}/WHEEL +0 -0
- {py2docfx-0.1.11rc1981066.dist-info → py2docfx-0.1.11rc1997820.dist-info}/top_level.txt +0 -0
@@ -1,5 +1,4 @@
|
|
1
1
|
#!/usr/bin/env python3
|
2
|
-
# -*- coding: UTF-8 -*
|
3
2
|
|
4
3
|
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
|
5
4
|
# Use of this source code is governed by a BSD-style license that can be
|
@@ -8,32 +7,27 @@
|
|
8
7
|
"""Windows specific tests."""
|
9
8
|
|
10
9
|
import datetime
|
11
|
-
import errno
|
12
10
|
import glob
|
13
11
|
import os
|
14
12
|
import platform
|
15
13
|
import re
|
14
|
+
import shutil
|
16
15
|
import signal
|
17
16
|
import subprocess
|
18
17
|
import sys
|
19
18
|
import time
|
20
19
|
import warnings
|
20
|
+
from unittest import mock
|
21
21
|
|
22
22
|
import psutil
|
23
23
|
from psutil import WINDOWS
|
24
|
-
from psutil._compat import FileNotFoundError
|
25
|
-
from psutil._compat import super
|
26
|
-
from psutil._compat import which
|
27
|
-
from psutil.tests import APPVEYOR
|
28
24
|
from psutil.tests import GITHUB_ACTIONS
|
29
25
|
from psutil.tests import HAS_BATTERY
|
30
26
|
from psutil.tests import IS_64BIT
|
31
|
-
from psutil.tests import PY3
|
32
27
|
from psutil.tests import PYPY
|
33
28
|
from psutil.tests import TOLERANCE_DISK_USAGE
|
34
29
|
from psutil.tests import TOLERANCE_SYS_MEM
|
35
30
|
from psutil.tests import PsutilTestCase
|
36
|
-
from psutil.tests import mock
|
37
31
|
from psutil.tests import pytest
|
38
32
|
from psutil.tests import retry_on_failure
|
39
33
|
from psutil.tests import sh
|
@@ -58,10 +52,6 @@ cext = psutil._psplatform.cext
|
|
58
52
|
|
59
53
|
@pytest.mark.skipif(not WINDOWS, reason="WINDOWS only")
|
60
54
|
@pytest.mark.skipif(PYPY, reason="pywin32 not available on PYPY")
|
61
|
-
# https://github.com/giampaolo/psutil/pull/1762#issuecomment-632892692
|
62
|
-
@pytest.mark.skipif(
|
63
|
-
GITHUB_ACTIONS and not PY3, reason="pywin32 broken on GITHUB + PY2"
|
64
|
-
)
|
65
55
|
class WindowsTestCase(PsutilTestCase):
|
66
56
|
pass
|
67
57
|
|
@@ -72,11 +62,11 @@ def powershell(cmd):
|
|
72
62
|
>>> powershell(
|
73
63
|
"Get-CIMInstance Win32_PageFileUsage | Select AllocatedBaseSize")
|
74
64
|
"""
|
75
|
-
if not which("powershell.exe"):
|
65
|
+
if not shutil.which("powershell.exe"):
|
76
66
|
raise pytest.skip("powershell.exe not available")
|
77
67
|
cmdline = (
|
78
|
-
|
79
|
-
|
68
|
+
"powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive "
|
69
|
+
f"-NoProfile -WindowStyle Hidden -Command \"{cmd}\"" # noqa: Q003
|
80
70
|
)
|
81
71
|
return sh(cmdline)
|
82
72
|
|
@@ -87,11 +77,11 @@ def wmic(path, what, converter=int):
|
|
87
77
|
>>> wmic("Win32_OperatingSystem", "FreePhysicalMemory")
|
88
78
|
2134124534
|
89
79
|
"""
|
90
|
-
out = sh("wmic path
|
80
|
+
out = sh(f"wmic path {path} get {what}").strip()
|
91
81
|
data = "".join(out.splitlines()[1:]).strip() # get rid of the header
|
92
82
|
if converter is not None:
|
93
83
|
if "," in what:
|
94
|
-
return tuple(
|
84
|
+
return tuple(converter(x) for x in data.split())
|
95
85
|
else:
|
96
86
|
return converter(data)
|
97
87
|
else:
|
@@ -152,7 +142,7 @@ class TestSystemAPIs(WindowsTestCase):
|
|
152
142
|
continue
|
153
143
|
if nic not in out:
|
154
144
|
raise self.fail(
|
155
|
-
"
|
145
|
+
f"{nic!r} nic wasn't found in 'ipconfig /all' output"
|
156
146
|
)
|
157
147
|
|
158
148
|
def test_total_phymem(self):
|
@@ -199,13 +189,12 @@ class TestSystemAPIs(WindowsTestCase):
|
|
199
189
|
# time.localtime(p.create_time()))
|
200
190
|
|
201
191
|
# Note: this test is not very reliable
|
202
|
-
@pytest.mark.skipif(APPVEYOR, reason="test not relieable on appveyor")
|
203
192
|
@retry_on_failure()
|
204
193
|
def test_pids(self):
|
205
194
|
# Note: this test might fail if the OS is starting/killing
|
206
195
|
# other processes in the meantime
|
207
196
|
w = wmi.WMI().Win32_Process()
|
208
|
-
wmi_pids =
|
197
|
+
wmi_pids = {x.ProcessId for x in w}
|
209
198
|
psutil_pids = set(psutil.pids())
|
210
199
|
assert wmi_pids == psutil_pids
|
211
200
|
|
@@ -233,12 +222,10 @@ class TestSystemAPIs(WindowsTestCase):
|
|
233
222
|
assert usage.free == wmi_free
|
234
223
|
# 10 MB tolerance
|
235
224
|
if abs(usage.free - wmi_free) > 10 * 1024 * 1024:
|
236
|
-
raise self.fail(
|
237
|
-
"psutil=%s, wmi=%s" % (usage.free, wmi_free)
|
238
|
-
)
|
225
|
+
raise self.fail(f"psutil={usage.free}, wmi={wmi_free}")
|
239
226
|
break
|
240
227
|
else:
|
241
|
-
raise self.fail("can't find partition
|
228
|
+
raise self.fail(f"can't find partition {ps_part!r}")
|
242
229
|
|
243
230
|
@retry_on_failure()
|
244
231
|
def test_disk_usage(self):
|
@@ -273,10 +260,9 @@ class TestSystemAPIs(WindowsTestCase):
|
|
273
260
|
for wmi_adapter in wmi_adapters:
|
274
261
|
wmi_names.add(wmi_adapter.Name)
|
275
262
|
wmi_names.add(wmi_adapter.NetConnectionID)
|
276
|
-
assert
|
277
|
-
ps_names
|
278
|
-
|
279
|
-
)
|
263
|
+
assert (
|
264
|
+
ps_names & wmi_names
|
265
|
+
), f"no common entries in {ps_names}, {wmi_names}"
|
280
266
|
|
281
267
|
def test_boot_time(self):
|
282
268
|
wmi_os = wmi.WMI().Win32_OperatingSystem()
|
@@ -443,7 +429,7 @@ class TestProcess(WindowsTestCase):
|
|
443
429
|
assert psutil.Process().username() == name
|
444
430
|
|
445
431
|
def test_cmdline(self):
|
446
|
-
sys_value = re.sub(
|
432
|
+
sys_value = re.sub(r"[ ]+", " ", win32api.GetCommandLine()).strip()
|
447
433
|
psutil_value = ' '.join(psutil.Process().cmdline())
|
448
434
|
if sys_value[0] == '"' != psutil_value[0]:
|
449
435
|
# The PyWin32 command line may retain quotes around argv[0] if they
|
@@ -563,7 +549,7 @@ class TestProcess(WindowsTestCase):
|
|
563
549
|
|
564
550
|
def test_error_partial_copy(self):
|
565
551
|
# https://github.com/giampaolo/psutil/issues/875
|
566
|
-
exc =
|
552
|
+
exc = OSError()
|
567
553
|
exc.winerror = 299
|
568
554
|
with mock.patch("psutil._psplatform.cext.proc_cwd", side_effect=exc):
|
569
555
|
with mock.patch("time.sleep") as m:
|
@@ -617,7 +603,7 @@ class TestProcessWMI(WindowsTestCase):
|
|
617
603
|
w = wmi.WMI().Win32_Process(ProcessId=self.pid)[0]
|
618
604
|
p = psutil.Process(self.pid)
|
619
605
|
domain, _, username = w.GetOwner()
|
620
|
-
username = "
|
606
|
+
username = f"{domain}\\{username}"
|
621
607
|
assert p.username() == username
|
622
608
|
|
623
609
|
@retry_on_failure()
|
@@ -638,7 +624,7 @@ class TestProcessWMI(WindowsTestCase):
|
|
638
624
|
# returned instead.
|
639
625
|
wmi_usage = int(w.PageFileUsage)
|
640
626
|
if vms not in {wmi_usage, wmi_usage * 1024}:
|
641
|
-
raise self.fail("wmi
|
627
|
+
raise self.fail(f"wmi={wmi_usage}, psutil={vms}")
|
642
628
|
|
643
629
|
def test_create_time(self):
|
644
630
|
w = wmi.WMI().Win32_Process(ProcessId=self.pid)[0]
|
@@ -676,7 +662,7 @@ class TestDualProcessImplementation(PsutilTestCase):
|
|
676
662
|
mem_1 = psutil.Process(self.pid).memory_info()
|
677
663
|
with mock.patch(
|
678
664
|
"psutil._psplatform.cext.proc_memory_info",
|
679
|
-
side_effect=
|
665
|
+
side_effect=PermissionError,
|
680
666
|
) as fun:
|
681
667
|
mem_2 = psutil.Process(self.pid).memory_info()
|
682
668
|
assert len(mem_1) == len(mem_2)
|
@@ -690,7 +676,7 @@ class TestDualProcessImplementation(PsutilTestCase):
|
|
690
676
|
ctime = psutil.Process(self.pid).create_time()
|
691
677
|
with mock.patch(
|
692
678
|
"psutil._psplatform.cext.proc_times",
|
693
|
-
side_effect=
|
679
|
+
side_effect=PermissionError,
|
694
680
|
) as fun:
|
695
681
|
assert psutil.Process(self.pid).create_time() == ctime
|
696
682
|
assert fun.called
|
@@ -699,7 +685,7 @@ class TestDualProcessImplementation(PsutilTestCase):
|
|
699
685
|
cpu_times_1 = psutil.Process(self.pid).cpu_times()
|
700
686
|
with mock.patch(
|
701
687
|
"psutil._psplatform.cext.proc_times",
|
702
|
-
side_effect=
|
688
|
+
side_effect=PermissionError,
|
703
689
|
) as fun:
|
704
690
|
cpu_times_2 = psutil.Process(self.pid).cpu_times()
|
705
691
|
assert fun.called
|
@@ -710,7 +696,7 @@ class TestDualProcessImplementation(PsutilTestCase):
|
|
710
696
|
io_counters_1 = psutil.Process(self.pid).io_counters()
|
711
697
|
with mock.patch(
|
712
698
|
"psutil._psplatform.cext.proc_io_counters",
|
713
|
-
side_effect=
|
699
|
+
side_effect=PermissionError,
|
714
700
|
) as fun:
|
715
701
|
io_counters_2 = psutil.Process(self.pid).io_counters()
|
716
702
|
for i in range(len(io_counters_1)):
|
@@ -721,7 +707,7 @@ class TestDualProcessImplementation(PsutilTestCase):
|
|
721
707
|
num_handles = psutil.Process(self.pid).num_handles()
|
722
708
|
with mock.patch(
|
723
709
|
"psutil._psplatform.cext.proc_num_handles",
|
724
|
-
side_effect=
|
710
|
+
side_effect=PermissionError,
|
725
711
|
) as fun:
|
726
712
|
assert psutil.Process(self.pid).num_handles() == num_handles
|
727
713
|
assert fun.called
|
@@ -838,7 +824,7 @@ class RemoteProcessTestCase(PsutilTestCase):
|
|
838
824
|
@pytest.mark.skipif(not WINDOWS, reason="WINDOWS only")
|
839
825
|
class TestServices(PsutilTestCase):
|
840
826
|
def test_win_service_iter(self):
|
841
|
-
valid_statuses =
|
827
|
+
valid_statuses = {
|
842
828
|
"running",
|
843
829
|
"paused",
|
844
830
|
"start",
|
@@ -846,9 +832,9 @@ class TestServices(PsutilTestCase):
|
|
846
832
|
"continue",
|
847
833
|
"stop",
|
848
834
|
"stopped",
|
849
|
-
|
850
|
-
valid_start_types =
|
851
|
-
valid_statuses =
|
835
|
+
}
|
836
|
+
valid_start_types = {"automatic", "manual", "disabled"}
|
837
|
+
valid_statuses = {
|
852
838
|
"running",
|
853
839
|
"paused",
|
854
840
|
"start_pending",
|
@@ -856,7 +842,7 @@ class TestServices(PsutilTestCase):
|
|
856
842
|
"continue_pending",
|
857
843
|
"stop_pending",
|
858
844
|
"stopped",
|
859
|
-
|
845
|
+
}
|
860
846
|
for serv in psutil.win_service_iter():
|
861
847
|
data = serv.as_dict()
|
862
848
|
assert isinstance(data['name'], str)
|
@@ -894,11 +880,8 @@ class TestServices(PsutilTestCase):
|
|
894
880
|
|
895
881
|
# test NoSuchProcess
|
896
882
|
service = psutil.win_service_get(name)
|
897
|
-
|
898
|
-
|
899
|
-
else:
|
900
|
-
args = (ERROR_SERVICE_DOES_NOT_EXIST, "msg")
|
901
|
-
exc = WindowsError(*args)
|
883
|
+
exc = OSError(0, "msg", 0)
|
884
|
+
exc.winerror = ERROR_SERVICE_DOES_NOT_EXIST
|
902
885
|
with mock.patch(
|
903
886
|
"psutil._psplatform.cext.winservice_query_status", side_effect=exc
|
904
887
|
):
|
@@ -911,11 +894,8 @@ class TestServices(PsutilTestCase):
|
|
911
894
|
service.username()
|
912
895
|
|
913
896
|
# test AccessDenied
|
914
|
-
|
915
|
-
|
916
|
-
else:
|
917
|
-
args = (ERROR_ACCESS_DENIED, "msg")
|
918
|
-
exc = WindowsError(*args)
|
897
|
+
exc = OSError(0, "msg", 0)
|
898
|
+
exc.winerror = ERROR_ACCESS_DENIED
|
919
899
|
with mock.patch(
|
920
900
|
"psutil._psplatform.cext.winservice_query_status", side_effect=exc
|
921
901
|
):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: py2docfx
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.11rc1997820
|
4
4
|
Summary: A package built based on Sphinx which download source code package and generate yaml files supported by docfx.
|
5
5
|
Author: Microsoft Corporation
|
6
6
|
License: MIT License
|