Skip to content

Commit

Permalink
Work around QiskitTestCase issue with Python 3.11.1 (#1001)
Browse files Browse the repository at this point in the history
See Qiskit/qiskit#9291

Co-authored-by: Ian Hincks <[email protected]>
  • Loading branch information
wshanks and ihincks authored Dec 20, 2022
1 parent c916909 commit d556f82
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@
import warnings
from typing import Any, Callable, Optional

# Temporary work around for https://github.com/Qiskit/qiskit-terra/issues/9291
# The class decorator / method wrapper in qiskit does not handle
# __init_subclass__ properly. Python 3.11.1 added an __init_subclass__ to
# TestCase. It's not that important so as a temporary hack we just drop it.
from unittest import TestCase

if "__init_subclass__" in TestCase.__dict__:
del TestCase.__init_subclass__
if not hasattr(TestCase, "_test_cleanups"):
TestCase._test_cleanups = []
if not hasattr(TestCase, "_classSetupFailed"):
TestCase._classSetupFailed = False
# pylint: disable=wrong-import-position

import numpy as np
import uncertainties
from lmfit import Model
Expand Down

0 comments on commit d556f82

Please sign in to comment.