Skip to content

Make GPU/NPU test collection safe on CPU-only hosts #95

Description

@morluto

Summary

Some GPU/NPU test modules perform device setup at import time. On CPU-only hosts, full pytest collection can fail before markers such as -m "not gpu" have a chance to deselect those tests.

Why this matters

CPU-only CI and local development should be able to collect and run the CPU test suite without initializing CUDA/NPU runtime state. Import-time device setup also makes failures harder to diagnose because collection fails before the test body runs.

Suggested fix

  • Avoid creating DeviceManager() or similar accelerator-dependent objects at module import time in test files.
  • Move accelerator setup into GPU-marked test functions or fixtures.
  • Skip inside those fixtures when the required accelerator runtime is unavailable.
  • Verify that pytest tests/ -m "not gpu" can collect and run on CPU-only hosts.

Expected outcome

CPU-only test runs should be able to execute non-GPU tests without CUDA/NPU initialization side effects during collection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions