Skip to content

Add unit tests for hardware.py #4

@pipe1os

Description

@pipe1os

Description

The src/modelinfo/hardware.py module handles normalizing GPU names, running local system stats via nvidia-smi/sysctl, and matching against KNOWN_GPUS. It currently has 0% test coverage.

We need to create tests/test_hardware.py with 100% coverage.

  • Test normalize_gpu_string (stripping spaces, "NVIDIA", etc).
  • Test resolve_gpu for direct matches and multi-GPU strings.
  • Test detect_local_gpu by mocking subprocess.run to prevent real terminal execution during tests.

Use Case

Prevents regressions when modifying hardware detection logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions