Skip to content

Commit 0ff8a31

Browse files
committed
Suppress false-positive warnings in test_gpustat.py
1 parent 0437e34 commit 0ff8a31

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

gpustat/test_gpustat.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
Unit or integration tests for gpustat
33
"""
44
# flake8: ignore=E501
5+
# pyright: reportGeneralTypeIssues=false
6+
# pylint: disable=protected-access,no-member
57

68
import ctypes
79
import os
10+
import re
811
import shlex
912
import sys
1013
import types
@@ -23,7 +26,6 @@
2326

2427

2528
def remove_ansi_codes(s):
26-
import re
2729
s = re.compile(r'\x1b[^m]*m').sub('', s)
2830
s = re.compile(r'\x0f').sub('', s)
2931
return s
@@ -63,6 +65,8 @@ def _callable(*args, **kwargs):
6365
return v
6466
return _callable
6567

68+
mock_memory_t = namedtuple("Memory_t", ['total', 'used']) # c_nvmlMemory_t
69+
6670
for i in range(NUM_GPUS):
6771
handle = mock_gpu_handles[i]
6872
if _scenario_failing_one_gpu and i == 2: # see #81, #125
@@ -101,7 +105,6 @@ def _callable(*args, **kwargs):
101105
}[i]))
102106

103107
# see also: NvidiaDriverMock
104-
mock_memory_t = namedtuple("Memory_t", ['total', 'used']) # c_nvmlMemory_t
105108
when(N).nvmlDeviceGetMemoryInfo(handle)\
106109
.thenAnswer(_return_or_raise({
107110
0: mock_memory_t(total=12883853312, used=8000*MB),

0 commit comments

Comments
 (0)