gpu_stats package

_base_test module

Unittests for the _base module

Pytest unit tests for lib.gpu_stats._base

tests.lib.gpu_stats._base_test.fixture__gpu_stats_instance(mocker: MockerFixture) _GPUStats

Create a fixture of the _GPUStats object

Parameters:

mocker (pytest_mock.MockerFixture) – Mocker for dummying in function calls

tests.lib.gpu_stats._base_test.test__gpu_stats_exclude_all_devices(gpu_stats_instance: _GPUStats) None

Ensure that the object correctly returns whether all devices are excluded

Parameters:

gpu_stats_instance (_GPUStats) – Fixture instance of the _GPUStats base class

tests.lib.gpu_stats._base_test.test__gpu_stats_get_card_most_free(mocker: MockerFixture, gpu_stats_instance: _GPUStats) None

Confirm that ib.gpu_stats._base._GPUStats.get_card_most_free() functions correctly

Parameters:
  • mocker (pytest_mock.MockerFixture) – Mocker for dummying in function calls

  • gpu_stats_instance (_GPUStats) – Fixture instance of the _GPUStats base class

tests.lib.gpu_stats._base_test.test__gpu_stats_init_(gpu_stats_instance: _GPUStats) None

Test that the base _GPUStats class initializes correctly

Parameters:

gpu_stats_instance (_GPUStats) – Fixture instance of the _GPUStats base class

tests.lib.gpu_stats._base_test.test__gpu_stats_no_active_devices(caplog: LogCaptureFixture, gpu_stats_instance: _GPUStats, mocker: MockerFixture) None

Ensure that no active GPUs raises a warning when not in CPU mode

Parameters:
  • caplog (pytest.LogCaptureFixture) – Pytest’s log capturing fixture

  • gpu_stats_instance (_GPUStats) – Fixture instance of the _GPUStats base class

  • mocker (pytest_mock.MockerFixture) – Mocker for dummying in function calls

tests.lib.gpu_stats._base_test.test__gpu_stats_properties(gpu_stats_instance: _GPUStats) None

Test that the _GPUStats properties are set and formatted correctly.

Parameters:

gpu_stats_instance (_GPUStats) – Fixture instance of the _GPUStats base class

tests.lib.gpu_stats._base_test.test_set_exclude_devices(monkeypatch: MonkeyPatch) None

Test that set_exclude_devices() adds devices

Parameters:

monkeypatch (pytest.MonkeyPatch) – Monkey patching _EXCLUDE_DEVICES