Skip to content

Add test for GPU detection when GPU is present #6

@m-marinucci

Description

@m-marinucci

As suggested in PR #1 by @sourcery-ai[bot]:

No test exists for PlatformDetector._detect_gpu() when GPU is present.

Task: Add a test case that mocks subprocess.run to simulate GPU presence and verifies correct detection.

Suggested test:

def test_detect_gpu_present(self):
    """Test GPU detection when GPU is present."""
    mock_completed_process = MagicMock()
    mock_completed_process.stdout = "NVIDIA-SMI 470.57.02    Driver Version: 470.57.02    CUDA Version: 11.4"
    with patch('subprocess.run', return_value=mock_completed_process):
        result = PlatformDetector._detect_gpu()
        assert result is True

File: tests/test_worker_service.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions