Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn on import failures within optional dependencies #11522

Merged
merged 3 commits into from
Jan 11, 2024

Commits on Jan 9, 2024

  1. Warn on import failures within optional dependencies

    This distinguishes the case of "failed to find an optional dependency"
    from "found the optional dependency, but it failed to import" within
    the lazy testers.  Now, a warning containing the import failures will be
    shown to users, rather than silently treating the dependency as missing.
    
    This occurred recently when a PR caused an import failure in Aer, which
    the CI suite failed to detect because the optional-dependency checkers
    allowed the test suite to pass regardless.  Note that this commit alone
    won't reliably cause the test suite to fail on a failed import because:
    
    1. this only emits a warning, not an exception (by design).
    2. the `unittest` decorators are evaluated during test discovery, which
       happens before we activate our increased warning filters.
    
    This commit also unifies the now two Qiskit-specific warnings (the other
    being `QPYLoadingDeprecatedFeatureWarning`) with a common
    `QiskitWarning` subclass, much as we do for `QiskitError`.  This gives
    us a convenient way to globally deny these errors during CI runs,
    without turning _all_ `UserWarning`s into errors, which we're not ready
    to do yet.
    jakelishman committed Jan 9, 2024
    Configuration menu
    Copy the full SHA
    693915b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    41c3081 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3703276 View commit details
    Browse the repository at this point in the history