Repository: huggingface/diffusers
File: tests/testing_utils.py (Python)

Code before:
    def decorator(test_case):
        correct_torch_version = is_torch_available() and is_torch_version(">=", torch_version)
        return pytest.mark.skipif(
            not correct_torch_version,
            reason=f"test requires torch with the version greater than or equal to {torch_version}",
        )(test_case)

    return decorator


def require_torch_version_greater(torch_version):
    """Decorator marking a test that requires torch with a specific version greater."""

    def decorator(test_case):
        correct_torch_version = is_torch_available() and is_torch_version(">", torch_version)
        return pytest.mark.skipif(
            not correct_torch_version, reason=f"test requires torch with the version greater than {torch_version}"
        )(test_case)

    return decorator


def require_torch_gpu(test_case):
    """Decorator marking a test that requires CUDA and PyTorch."""
    return pytest.mark.skipif(
        not (is_torch_available() and torch_device == "cuda"), reason="test requires PyTorch+CUDA"
    )(test_case)


def require_torch_cuda_compatibility(expected_compute_capability):
    def decorator(test_case):
        if torch.cuda.is_available():
            current_compute_capability = get_torch_cuda_device_capability()
            return pytest.mark.skipif(
                float(current_compute_capability) != float(expected_compute_capability),
                reason="Test not supported for this compute capability.",
            )(test_case)
        return test_case

    return decorator


# These decorators are for accelerator-specific behaviours that are not GPU-specific
def require_torch_accelerator(test_case):
    """Decorator marking a test that requires an accelerator backend and PyTorch."""
    return pytest.mark.skipif(
        not (is_torch_available() and torch_device != "cpu"), reason="test requires accelerator+PyTorch"
    )(test_case)


def require_torch_multi_gpu(test_case):

Review comment (suggestion):
Simpler and easier to read

```suggestion
        torch_device != "cuda", reason="test requires PyTorch+CUDA"
```

Code after:
    def decorator(test_case):
        correct_torch_version = is_torch_available() and is_torch_version(">=", torch_version)
        return pytest.mark.skipif(
            not correct_torch_version,
            reason=f"test requires torch with the version greater than or equal to {torch_version}",
        )(test_case)

    return decorator


def require_torch_version_greater(torch_version):
    """Decorator marking a test that requires torch with a specific version greater."""

    def decorator(test_case):
        correct_torch_version = is_torch_available() and is_torch_version(">", torch_version)
        return pytest.mark.skipif(
            not correct_torch_version, reason=f"test requires torch with the version greater than {torch_version}"
        )(test_case)

    return decorator


def require_torch_gpu(test_case):
    """Decorator marking a test that requires CUDA and PyTorch."""
    return pytest.mark.skipif(torch_device != "cuda", reason="test requires PyTorch+CUDA")(test_case)


def require_torch_cuda_compatibility(expected_compute_capability):
    def decorator(test_case):
        if torch.cuda.is_available():
            current_compute_capability = get_torch_cuda_device_capability()
            return pytest.mark.skipif(
                float(current_compute_capability) != float(expected_compute_capability),
                reason="Test not supported for this compute capability.",
            )(test_case)
        return test_case

    return decorator


# These decorators are for accelerator-specific behaviours that are not GPU-specific
def require_torch_accelerator(test_case):
    """Decorator marking a test that requires an accelerator backend and PyTorch."""
    return pytest.mark.skipif(torch_device == "cpu", reason="test requires accelerator+PyTorch")(test_case)


def require_torch_multi_gpu(test_case):
    """
    Decorator marking a test that requires a multi-GPU setup (in PyTorch). These tests are skipped on a machine without
    multiple GPUs. To run *only* the multi_gpu tests, assuming all test names contain multi_gpu: $ pytest -sv ./tests
    -k "multi_gpu"