Example #1
0
def test_configure_device_to_get_second_gpu_energy_with_no_second_gpu_api_raise_NoSuchDomainError(
        one_gpu_api):
    device = NvidiaGPUDevice()

    with pytest.raises(NoSuchDomainError):
        device.configure([NvidiaGPUDomain(1)])
Example #2
0
def test_available_domains_with_two_gpu_api_return_correct_values(two_gpu_api):
    returned_values = NvidiaGPUDevice.available_domains()
    correct_values = [NvidiaGPUDomain(0), NvidiaGPUDomain(1)]
    assert sorted(correct_values) == sorted(returned_values)
Example #3
0
def test_get_device_type_return_NvidiaGPUDevice():
    domain = NvidiaGPUDomain(0)
    assert domain.get_device_type() == NvidiaGPUDevice
Example #4
0
def test_repr_return_nvidia_gpu_underscore_device_id(integer_value):
    domain = NvidiaGPUDomain(integer_value)
    assert str(domain) == 'nvidia_gpu_' + str(integer_value)
Example #5
0
def test_create_devices_to_monitor_gpu1_with_only_one_gpu_api_raise_NoSuchDomainError(
        one_gpu_api):
    with pytest.raises(NoSuchDomainError):
        EnergyDeviceFactory.create_devices([NvidiaGPUDomain(1)])
Example #6
0
def test_create_devices_to_monitor_gpu0_without_gpu_api_raise_NoSuchEnergyDeviceError(
        no_gpu_api):
    with pytest.raises(NoSuchEnergyDeviceError):
        EnergyDeviceFactory.create_devices([NvidiaGPUDomain(0)])