Skip to content

Comments

Improve coverage for qumat/qdp.py by testing stub fallback behavior#1081

Closed
alisha-1000 wants to merge 1 commit intoapache:mainfrom
alisha-1000:improve-qdp-python-coverage
Closed

Improve coverage for qumat/qdp.py by testing stub fallback behavior#1081
alisha-1000 wants to merge 1 commit intoapache:mainfrom
alisha-1000:improve-qdp-python-coverage

Conversation

@alisha-1000
Copy link

Related Issues

N/A

Changes

  • Bug fix
  • New feature
  • Refactoring
  • Documentation
  • Test
  • CI/CD pipeline
  • Other

Why

qumat/qdp.py provides a fallback stub implementation when the native _qdp
extension is not available. This behavior is important for environments
without GPU/native builds, but it was not explicitly covered by tests.

Adding dedicated tests ensures that the fallback mechanism works as expected
and remains stable over time.

How

  • Added testing/qumat/test_qdp_stub.py
  • Forced a fresh import of qumat.qdp to trigger the fallback code path
  • Verified that:
    • An ImportWarning is emitted when _qdp is unavailable
    • Stub classes (QdpEngine, QuantumTensor) raise ImportError on instantiation
    • __all__ exports are correctly defined

All existing tests pass locally:

  • 561 passed
  • 91 skipped
  • Total coverage: 93% (442 statements, 32 missed)

This change improves coverage for qumat/qdp.py without modifying runtime behavior or affecting the native extension logic.

Checklist

  • Added or updated unit tests for all changes
  • Added or updated documentation for all changes

@alisha-1000
Copy link
Author

Superseded by #1084, which contains a more complete and refined coverage update for qumat/qdp.py.

Closing this PR to avoid duplication and keep the history clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants