class_docstr: A pytest class suite for gpustat.
class_docstr_tok: ["A","pytest","class","suite","for","gpustat","."]
docstr: Test a case where one GPU is failing (see #125).
code: def test_new_query_mocked_failing_one_gpu(
      self, scenario_failing_one_gpu
  ):
      """Test a case where one GPU is failing (see #125)."""
      fp = StringIO()
      gpustats = gpustat.new_query()
      gpustats.print_formatted(fp=fp, show_header=False)
      ret = fp.getvalue()
      print(ret)
  
      lines = remove_ansi_codes(ret).split("\n")
      message = scenario_failing_one_gpu["expected_message"]
  
      # gpu 2: failing due to unknown error
      line = lines[2]
      assert "[2] ((" + message + "))" in line, str(line)
      assert "99999" not in line
      assert "??°C,  ?? %" in line, str(line)
      assert "?? /    ?? MB" in line, str(line)
  
      # other gpus should be displayed normally
      assert "[0] GeForce GTX TITAN 0" in lines[0]
      assert "[1] GeForce GTX TITAN 1" in lines[1]
  
imports: import ctypes
  import os
  import re
  import shlex
  import sys
  import types
  from collections import namedtuple
  from io import StringIO
  from typing import Any
  import psutil
  import pytest
  from mockito import ANY, mock, unstub, when, when2
  import gpustat
  from gpustat.nvml import pynvml, pynvml_monkeypatch
label_desc: Use image node_id 6 for calling the TestGPUStat obj's underlying member method code with example usage: obj.test_new_query_mocked_failing_one_gpu(scenario_failing_one_gpu) without return types