microsoft/qdk
Publicmirrored from https://github.com/microsoft/qdkAvailable
source/pip/tests-integration/interop_qiskit/__init__.py
26lines · modecode
| 1 | # Copyright (c) Microsoft Corporation. |
| 2 | # Licensed under the MIT License. |
| 3 | |
| 4 | import pytest |
| 5 | |
| 6 | try: |
| 7 | # pylint: disable=unused-import |
| 8 | import qiskit |
| 9 | |
| 10 | QISKIT_AVAILABLE = True |
| 11 | except ImportError: |
| 12 | QISKIT_AVAILABLE = False |
| 13 | |
| 14 | SKIP_REASON = "Qiskit is not available" |
| 15 | |
| 16 | |
| 17 | def ignore_on_failure(func): |
| 18 | def wrapper(*args, **kwargs): |
| 19 | try: |
| 20 | func(*args, **kwargs) |
| 21 | except Exception: |
| 22 | pytest.skip("Test failed, skipping for now.") |
| 23 | else: |
| 24 | raise AssertionError("Test passed, remove decorator.") |
| 25 | |
| 26 | return wrapper |
| 27 | |