diff --git a/releasenotes/notes/remove_qiskit_test-84bee228d8d768df.yaml b/releasenotes/notes/remove_qiskit_test-84bee228d8d768df.yaml new file mode 100644 index 000000000000..2ff43bd7f22d --- /dev/null +++ b/releasenotes/notes/remove_qiskit_test-84bee228d8d768df.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + Remove ``qiskit.test``. This includes ``qiskit.test.QiskitTestCase`` (and ``BasicQiskitTestCase``) + which are now for interal unittesting use. diff --git a/test/__init__.py b/test/__init__.py index e9f30e041cad..c0538ca6d161 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -15,6 +15,9 @@ import itertools from ddt import data, unpack +from .utils.base import QiskitTestCase +from .utils.decorators import slow_test + class Case(dict): """""" diff --git a/test/benchmarks/transpiler_qualitative.py b/test/benchmarks/transpiler_qualitative.py index 8bef47c5dad9..12fa87942300 100644 --- a/test/benchmarks/transpiler_qualitative.py +++ b/test/benchmarks/transpiler_qualitative.py @@ -17,7 +17,7 @@ from qiskit import QuantumCircuit from qiskit.compiler import transpile -from qiskit.test.mock import FakeToronto +from qiskit.providers.fake_provider import FakeToronto class TranspilerQualitativeBench: diff --git a/test/python/circuit/classical/test_expr_constructors.py b/test/python/circuit/classical/test_expr_constructors.py index a9a344034b03..b655acf57496 100644 --- a/test/python/circuit/classical/test_expr_constructors.py +++ b/test/python/circuit/classical/test_expr_constructors.py @@ -16,7 +16,7 @@ from qiskit.circuit import Clbit, ClassicalRegister, Instruction from qiskit.circuit.classical import expr, types -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt.ddt diff --git a/test/python/circuit/classical/test_expr_helpers.py b/test/python/circuit/classical/test_expr_helpers.py index f7b420c07144..2ff31058899d 100644 --- a/test/python/circuit/classical/test_expr_helpers.py +++ b/test/python/circuit/classical/test_expr_helpers.py @@ -17,7 +17,7 @@ from qiskit.circuit import Clbit, ClassicalRegister from qiskit.circuit.classical import expr, types -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt.ddt diff --git a/test/python/circuit/classical/test_expr_properties.py b/test/python/circuit/classical/test_expr_properties.py index 34ad2cf4295a..33706a1e4979 100644 --- a/test/python/circuit/classical/test_expr_properties.py +++ b/test/python/circuit/classical/test_expr_properties.py @@ -14,12 +14,11 @@ import copy import pickle - import ddt -from qiskit.test import QiskitTestCase from qiskit.circuit import ClassicalRegister, Clbit from qiskit.circuit.classical import expr, types +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt.ddt diff --git a/test/python/circuit/classical/test_types_ordering.py b/test/python/circuit/classical/test_types_ordering.py index 58417fb17c03..16c3791f70fa 100644 --- a/test/python/circuit/classical/test_types_ordering.py +++ b/test/python/circuit/classical/test_types_ordering.py @@ -13,7 +13,7 @@ # pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring from qiskit.circuit.classical import types -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestTypesOrdering(QiskitTestCase): diff --git a/test/python/circuit/library/test_adders.py b/test/python/circuit/library/test_adders.py index b14d7b89bc4c..0866cb766710 100644 --- a/test/python/circuit/library/test_adders.py +++ b/test/python/circuit/library/test_adders.py @@ -16,10 +16,10 @@ import numpy as np from ddt import ddt, data, unpack -from qiskit.test.base import QiskitTestCase from qiskit.circuit import QuantumCircuit from qiskit.quantum_info import Statevector from qiskit.circuit.library import CDKMRippleCarryAdder, DraperQFTAdder, VBERippleCarryAdder +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/library/test_blueprintcircuit.py b/test/python/circuit/library/test_blueprintcircuit.py index 0935694981e7..2a5070e8ac74 100644 --- a/test/python/circuit/library/test_blueprintcircuit.py +++ b/test/python/circuit/library/test_blueprintcircuit.py @@ -16,7 +16,6 @@ import unittest from ddt import ddt, data -from qiskit.test.base import QiskitTestCase from qiskit.circuit import ( QuantumRegister, Parameter, @@ -26,6 +25,7 @@ CircuitInstruction, ) from qiskit.circuit.library import BlueprintCircuit, XGate +from test import QiskitTestCase # pylint: disable=wrong-import-order class MockBlueprint(BlueprintCircuit): diff --git a/test/python/circuit/library/test_boolean_logic.py b/test/python/circuit/library/test_boolean_logic.py index b551d673c67b..cdadc9142a97 100644 --- a/test/python/circuit/library/test_boolean_logic.py +++ b/test/python/circuit/library/test_boolean_logic.py @@ -16,10 +16,10 @@ from ddt import ddt, data, unpack import numpy as np -from qiskit.test.base import QiskitTestCase from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import XOR, InnerProduct, AND, OR from qiskit.quantum_info import Statevector +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/library/test_diagonal.py b/test/python/circuit/library/test_diagonal.py index 829864213186..7dde0d62d8ff 100644 --- a/test/python/circuit/library/test_diagonal.py +++ b/test/python/circuit/library/test_diagonal.py @@ -16,10 +16,10 @@ from ddt import ddt, data import numpy as np -from qiskit.test.base import QiskitTestCase from qiskit.circuit.library import Diagonal from qiskit.quantum_info import Statevector, Operator from qiskit.quantum_info.operators.predicates import matrix_equal +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/library/test_evolution_gate.py b/test/python/circuit/library/test_evolution_gate.py index fb13f5de88ae..e407cf0341d9 100644 --- a/test/python/circuit/library/test_evolution_gate.py +++ b/test/python/circuit/library/test_evolution_gate.py @@ -21,8 +21,8 @@ from qiskit.circuit.library import PauliEvolutionGate from qiskit.synthesis import LieTrotter, SuzukiTrotter, MatrixExponential, QDrift from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase from qiskit.quantum_info import Operator, SparsePauliOp, Pauli, Statevector +from test import QiskitTestCase # pylint: disable=wrong-import-order X = SparsePauliOp("X") Y = SparsePauliOp("Y") diff --git a/test/python/circuit/library/test_evolved_op_ansatz.py b/test/python/circuit/library/test_evolved_op_ansatz.py index c0b233692e5c..a2b819886cda 100644 --- a/test/python/circuit/library/test_evolved_op_ansatz.py +++ b/test/python/circuit/library/test_evolved_op_ansatz.py @@ -20,7 +20,7 @@ from qiskit.circuit.library import HamiltonianGate from qiskit.circuit.library.n_local import EvolvedOperatorAnsatz from qiskit.synthesis.evolution import MatrixExponential -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestEvolvedOperatorAnsatz(QiskitTestCase): diff --git a/test/python/circuit/library/test_fourier_checking.py b/test/python/circuit/library/test_fourier_checking.py index 3a7dba1f5060..23595d70d95c 100644 --- a/test/python/circuit/library/test_fourier_checking.py +++ b/test/python/circuit/library/test_fourier_checking.py @@ -16,10 +16,10 @@ from ddt import ddt, data, unpack import numpy as np -from qiskit.test.base import QiskitTestCase from qiskit.circuit.library import FourierChecking from qiskit.circuit.exceptions import CircuitError from qiskit.quantum_info import Operator +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/library/test_functional_pauli_rotations.py b/test/python/circuit/library/test_functional_pauli_rotations.py index 638608c95690..cb2ba2e09a10 100644 --- a/test/python/circuit/library/test_functional_pauli_rotations.py +++ b/test/python/circuit/library/test_functional_pauli_rotations.py @@ -17,7 +17,6 @@ import numpy as np from ddt import ddt, data, unpack -from qiskit.test.base import QiskitTestCase from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import ( LinearPauliRotations, @@ -25,6 +24,7 @@ PiecewiseLinearPauliRotations, ) from qiskit.quantum_info import Statevector +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/library/test_global_r.py b/test/python/circuit/library/test_global_r.py index 8802e3974fb6..bce2a6f76dc2 100644 --- a/test/python/circuit/library/test_global_r.py +++ b/test/python/circuit/library/test_global_r.py @@ -15,9 +15,9 @@ import unittest import numpy as np -from qiskit.test.base import QiskitTestCase from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import GR, GRX, GRY, GRZ, RGate, RZGate +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestGlobalRLibrary(QiskitTestCase): diff --git a/test/python/circuit/library/test_gms.py b/test/python/circuit/library/test_gms.py index b51e0b1fa58b..efcb129bd30f 100644 --- a/test/python/circuit/library/test_gms.py +++ b/test/python/circuit/library/test_gms.py @@ -15,9 +15,9 @@ import unittest import numpy as np -from qiskit.test.base import QiskitTestCase from qiskit.circuit.library import GMS, RXXGate from qiskit.quantum_info import Operator +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestGMSLibrary(QiskitTestCase): diff --git a/test/python/circuit/library/test_graph_state.py b/test/python/circuit/library/test_graph_state.py index 33b8ab03872d..dbefa2cebd3d 100644 --- a/test/python/circuit/library/test_graph_state.py +++ b/test/python/circuit/library/test_graph_state.py @@ -17,7 +17,7 @@ from qiskit.circuit.exceptions import CircuitError from qiskit.circuit.library import GraphState from qiskit.quantum_info import Clifford -from qiskit.test.base import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestGraphStateLibrary(QiskitTestCase): diff --git a/test/python/circuit/library/test_grover_operator.py b/test/python/circuit/library/test_grover_operator.py index 098213e6e590..5a4f74f161c9 100644 --- a/test/python/circuit/library/test_grover_operator.py +++ b/test/python/circuit/library/test_grover_operator.py @@ -15,11 +15,11 @@ import unittest import numpy as np -from qiskit.test.base import QiskitTestCase from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import GroverOperator from qiskit.converters import circuit_to_dag from qiskit.quantum_info import Operator, Statevector, DensityMatrix +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestGroverOperator(QiskitTestCase): diff --git a/test/python/circuit/library/test_hidden_linear_function.py b/test/python/circuit/library/test_hidden_linear_function.py index c971c560827e..bc7d9c7545b6 100644 --- a/test/python/circuit/library/test_hidden_linear_function.py +++ b/test/python/circuit/library/test_hidden_linear_function.py @@ -15,11 +15,11 @@ import unittest import numpy as np -from qiskit.test.base import QiskitTestCase from qiskit.circuit import QuantumCircuit from qiskit.circuit.exceptions import CircuitError from qiskit.circuit.library import HiddenLinearFunction from qiskit.quantum_info import Operator +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestHiddenLinearFunctionLibrary(QiskitTestCase): diff --git a/test/python/circuit/library/test_integer_comparator.py b/test/python/circuit/library/test_integer_comparator.py index 7de451975d5f..66ae2f6aec9d 100644 --- a/test/python/circuit/library/test_integer_comparator.py +++ b/test/python/circuit/library/test_integer_comparator.py @@ -16,10 +16,10 @@ import numpy as np from ddt import ddt, data, unpack -from qiskit.test.base import QiskitTestCase from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import IntegerComparator from qiskit.quantum_info import Statevector +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/library/test_iqp.py b/test/python/circuit/library/test_iqp.py index 6fb6c90a03ca..b371e5546525 100644 --- a/test/python/circuit/library/test_iqp.py +++ b/test/python/circuit/library/test_iqp.py @@ -15,11 +15,11 @@ import unittest import numpy as np -from qiskit.test.base import QiskitTestCase from qiskit.circuit import QuantumCircuit from qiskit.circuit.exceptions import CircuitError from qiskit.circuit.library import IQP from qiskit.quantum_info import Operator +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestIQPLibrary(QiskitTestCase): diff --git a/test/python/circuit/library/test_linear_amplitude_function.py b/test/python/circuit/library/test_linear_amplitude_function.py index 24147e12377e..f2824ebc6bf1 100644 --- a/test/python/circuit/library/test_linear_amplitude_function.py +++ b/test/python/circuit/library/test_linear_amplitude_function.py @@ -18,10 +18,10 @@ from ddt import ddt, data, unpack import numpy as np -from qiskit.test.base import QiskitTestCase from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import LinearAmplitudeFunction from qiskit.quantum_info import Statevector +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/library/test_linear_function.py b/test/python/circuit/library/test_linear_function.py index 5f3227fac5c2..6dd087841bda 100644 --- a/test/python/circuit/library/test_linear_function.py +++ b/test/python/circuit/library/test_linear_function.py @@ -16,16 +16,14 @@ import numpy as np from ddt import ddt, data -from qiskit.test import QiskitTestCase from qiskit.circuit import QuantumCircuit from qiskit.quantum_info import Clifford - from qiskit.circuit.library.standard_gates import CXGate, SwapGate from qiskit.circuit.library.generalized_gates import LinearFunction, PermutationGate from qiskit.circuit.exceptions import CircuitError from qiskit.synthesis.linear import random_invertible_binary_matrix - from qiskit.quantum_info.operators import Operator +from test import QiskitTestCase # pylint: disable=wrong-import-order def random_linear_circuit( diff --git a/test/python/circuit/library/test_mcmt.py b/test/python/circuit/library/test_mcmt.py index 3d33a9a2ad2c..558228422495 100644 --- a/test/python/circuit/library/test_mcmt.py +++ b/test/python/circuit/library/test_mcmt.py @@ -16,12 +16,12 @@ from ddt import ddt, data, unpack import numpy as np -from qiskit.test.base import QiskitTestCase from qiskit.exceptions import QiskitError from qiskit.circuit import QuantumCircuit, QuantumRegister from qiskit.circuit.library import MCMT, MCMTVChain, CHGate, XGate, ZGate, CXGate, CZGate from qiskit.quantum_info import Statevector from qiskit.quantum_info.states import state_fidelity +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/library/test_multipliers.py b/test/python/circuit/library/test_multipliers.py index e84e7dc3e9cd..fd083e287153 100644 --- a/test/python/circuit/library/test_multipliers.py +++ b/test/python/circuit/library/test_multipliers.py @@ -16,7 +16,6 @@ import numpy as np from ddt import ddt, data, unpack -from qiskit.test.base import QiskitTestCase from qiskit.circuit import QuantumCircuit from qiskit.quantum_info import Statevector from qiskit.circuit.library import ( @@ -26,6 +25,7 @@ DraperQFTAdder, VBERippleCarryAdder, ) +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/library/test_nlocal.py b/test/python/circuit/library/test_nlocal.py index 62e7912606b8..fc003328b1ac 100644 --- a/test/python/circuit/library/test_nlocal.py +++ b/test/python/circuit/library/test_nlocal.py @@ -19,7 +19,6 @@ from ddt import ddt, data, unpack -from qiskit.test.base import QiskitTestCase from qiskit import transpile from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector, ParameterExpression from qiskit.circuit.library import ( @@ -42,6 +41,7 @@ from qiskit.circuit.random.utils import random_circuit from qiskit.converters.circuit_to_dag import circuit_to_dag from qiskit.quantum_info import Operator +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/library/test_overlap.py b/test/python/circuit/library/test_overlap.py index fa5e4af05c0d..a603f28037b1 100644 --- a/test/python/circuit/library/test_overlap.py +++ b/test/python/circuit/library/test_overlap.py @@ -14,11 +14,11 @@ import unittest import numpy as np -from qiskit.test.base import QiskitTestCase from qiskit.circuit import QuantumCircuit, Qubit, Clbit from qiskit.circuit.library import EfficientSU2, UnitaryOverlap from qiskit.quantum_info import Statevector from qiskit.circuit.exceptions import CircuitError +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestUnitaryOverlap(QiskitTestCase): diff --git a/test/python/circuit/library/test_pauli_feature_map.py b/test/python/circuit/library/test_pauli_feature_map.py index 4cdc199b899f..c43c2b5f6f1f 100644 --- a/test/python/circuit/library/test_pauli_feature_map.py +++ b/test/python/circuit/library/test_pauli_feature_map.py @@ -16,13 +16,12 @@ from test import combine import numpy as np - from ddt import ddt, data, unpack -from qiskit.test.base import QiskitTestCase from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector from qiskit.circuit.library import PauliFeatureMap, ZFeatureMap, ZZFeatureMap, HGate from qiskit.quantum_info import Operator +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/library/test_permutation.py b/test/python/circuit/library/test_permutation.py index aacc5425d74b..30d504d7dc8f 100644 --- a/test/python/circuit/library/test_permutation.py +++ b/test/python/circuit/library/test_permutation.py @@ -19,13 +19,13 @@ import numpy as np from qiskit import QuantumRegister -from qiskit.test.base import QiskitTestCase from qiskit.circuit import QuantumCircuit from qiskit.circuit.exceptions import CircuitError from qiskit.circuit.library import Permutation, PermutationGate from qiskit.quantum_info import Operator from qiskit.qpy import dump, load from qiskit.qasm2 import dumps +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestPermutationLibrary(QiskitTestCase): diff --git a/test/python/circuit/library/test_phase_estimation.py b/test/python/circuit/library/test_phase_estimation.py index 71b13e6f8c1e..28b388a15b2e 100644 --- a/test/python/circuit/library/test_phase_estimation.py +++ b/test/python/circuit/library/test_phase_estimation.py @@ -13,13 +13,12 @@ """Test library of phase estimation circuits.""" import unittest - import numpy as np -from qiskit.test.base import QiskitTestCase from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import PhaseEstimation, QFT from qiskit.quantum_info import Statevector +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestPhaseEstimation(QiskitTestCase): diff --git a/test/python/circuit/library/test_phase_oracle.py b/test/python/circuit/library/test_phase_oracle.py index e15d6df8ee60..bec77f3c9430 100644 --- a/test/python/circuit/library/test_phase_oracle.py +++ b/test/python/circuit/library/test_phase_oracle.py @@ -17,10 +17,10 @@ from numpy import sqrt, isclose from qiskit.circuit import QuantumCircuit -from qiskit.test.base import QiskitTestCase from qiskit.circuit.library import PhaseOracle from qiskit.quantum_info import Statevector from qiskit.utils.optionals import HAS_TWEEDLEDUM +from test import QiskitTestCase # pylint: disable=wrong-import-order @unittest.skipUnless(HAS_TWEEDLEDUM, "Tweedledum is required for these tests") diff --git a/test/python/circuit/library/test_piecewise_chebyshev.py b/test/python/circuit/library/test_piecewise_chebyshev.py index f0d738ec9e29..cccbd1731830 100644 --- a/test/python/circuit/library/test_piecewise_chebyshev.py +++ b/test/python/circuit/library/test_piecewise_chebyshev.py @@ -17,10 +17,10 @@ import numpy as np from ddt import ddt, data, unpack -from qiskit.test.base import QiskitTestCase from qiskit.circuit import QuantumCircuit from qiskit.circuit.library.arithmetic.piecewise_chebyshev import PiecewiseChebyshev from qiskit.quantum_info import Statevector +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/library/test_qaoa_ansatz.py b/test/python/circuit/library/test_qaoa_ansatz.py index fcd062152bfa..799bc9362a0d 100644 --- a/test/python/circuit/library/test_qaoa_ansatz.py +++ b/test/python/circuit/library/test_qaoa_ansatz.py @@ -19,7 +19,7 @@ from qiskit.circuit.library import HGate, RXGate, YGate, RYGate, RZGate from qiskit.circuit.library.n_local.qaoa_ansatz import QAOAAnsatz from qiskit.quantum_info import Pauli, SparsePauliOp -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/library/test_qft.py b/test/python/circuit/library/test_qft.py index fa5305aa3631..3d85bb526dc2 100644 --- a/test/python/circuit/library/test_qft.py +++ b/test/python/circuit/library/test_qft.py @@ -17,11 +17,11 @@ import numpy as np from ddt import ddt, data, unpack -from qiskit.test.base import QiskitTestCase from qiskit import transpile from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import QFT from qiskit.quantum_info import Operator +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/library/test_quadratic_form.py b/test/python/circuit/library/test_quadratic_form.py index 4c68708b4a9b..a97b030f0d28 100644 --- a/test/python/circuit/library/test_quadratic_form.py +++ b/test/python/circuit/library/test_quadratic_form.py @@ -16,10 +16,10 @@ from ddt import ddt, data import numpy as np -from qiskit.test.base import QiskitTestCase from qiskit.circuit import QuantumCircuit, ParameterVector from qiskit.circuit.library import QuadraticForm from qiskit.quantum_info import Statevector +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/library/test_quantum_volume.py b/test/python/circuit/library/test_quantum_volume.py index f9a2119031be..f2d809fec399 100644 --- a/test/python/circuit/library/test_quantum_volume.py +++ b/test/python/circuit/library/test_quantum_volume.py @@ -14,7 +14,7 @@ import unittest -from qiskit.test.base import QiskitTestCase +from test.utils.base import QiskitTestCase from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import QuantumVolume from qiskit.quantum_info import Operator diff --git a/test/python/circuit/library/test_random_pauli.py b/test/python/circuit/library/test_random_pauli.py index 5180b44ba01f..2d07efd51cb3 100644 --- a/test/python/circuit/library/test_random_pauli.py +++ b/test/python/circuit/library/test_random_pauli.py @@ -16,9 +16,9 @@ import numpy as np -from qiskit.test.base import QiskitTestCase from qiskit.circuit import QuantumCircuit, QuantumRegister from qiskit.circuit.library import PauliTwoDesign +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestPauliTwoDesign(QiskitTestCase): diff --git a/test/python/circuit/library/test_state_preparation.py b/test/python/circuit/library/test_state_preparation.py index f34141ce596c..f4966ab61a73 100644 --- a/test/python/circuit/library/test_state_preparation.py +++ b/test/python/circuit/library/test_state_preparation.py @@ -21,9 +21,9 @@ from qiskit import QuantumCircuit, QuantumRegister from qiskit.quantum_info import Statevector, Operator -from qiskit.test import QiskitTestCase from qiskit.exceptions import QiskitError from qiskit.circuit.library import StatePreparation +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/library/test_weighted_adder.py b/test/python/circuit/library/test_weighted_adder.py index 4003588bbc0c..42f947ecf37e 100644 --- a/test/python/circuit/library/test_weighted_adder.py +++ b/test/python/circuit/library/test_weighted_adder.py @@ -17,10 +17,10 @@ from ddt import ddt, data import numpy as np -from qiskit.test.base import QiskitTestCase from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import WeightedAdder from qiskit.quantum_info import Statevector +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/test_annotated_operation.py b/test/python/circuit/test_annotated_operation.py index 46fc32b021c6..e26d3f845e79 100644 --- a/test/python/circuit/test_annotated_operation.py +++ b/test/python/circuit/test_annotated_operation.py @@ -15,7 +15,6 @@ import unittest from qiskit.circuit._utils import _compute_control_matrix -from qiskit.test import QiskitTestCase from qiskit.circuit.annotated_operation import ( AnnotatedOperation, ControlModifier, @@ -25,6 +24,7 @@ ) from qiskit.circuit.library import SGate, SdgGate from qiskit.quantum_info import Operator +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestAnnotatedOperationlass(QiskitTestCase): diff --git a/test/python/circuit/test_bit.py b/test/python/circuit/test_bit.py index cbacba159ab9..e93d7baf0dd7 100644 --- a/test/python/circuit/test_bit.py +++ b/test/python/circuit/test_bit.py @@ -16,8 +16,8 @@ import copy from unittest import mock -from qiskit.test import QiskitTestCase from qiskit.circuit import bit +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestBitClass(QiskitTestCase): diff --git a/test/python/circuit/test_calibrations.py b/test/python/circuit/test_calibrations.py index 36a3dcc2ff61..cd0d4cb0b6cb 100644 --- a/test/python/circuit/test_calibrations.py +++ b/test/python/circuit/test_calibrations.py @@ -17,7 +17,7 @@ from qiskit.pulse import Schedule from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import RZXGate -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCalibrations(QiskitTestCase): diff --git a/test/python/circuit/test_circuit_data.py b/test/python/circuit/test_circuit_data.py index bc18f59ce95c..f2292b18a62b 100644 --- a/test/python/circuit/test_circuit_data.py +++ b/test/python/circuit/test_circuit_data.py @@ -12,8 +12,8 @@ """Test operations on circuit.data.""" import ddt -from qiskit._accelerate.quantum_circuit import CircuitData +from qiskit._accelerate.quantum_circuit import CircuitData from qiskit.circuit import ( ClassicalRegister, QuantumCircuit, @@ -25,9 +25,8 @@ Clbit, ) from qiskit.circuit.library import HGate, XGate, CXGate, RXGate, Measure - -from qiskit.test import QiskitTestCase from qiskit.circuit.exceptions import CircuitError +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt.ddt diff --git a/test/python/circuit/test_circuit_find_bit.py b/test/python/circuit/test_circuit_find_bit.py index 6d933999117a..5d6808eb90f2 100644 --- a/test/python/circuit/test_circuit_find_bit.py +++ b/test/python/circuit/test_circuit_find_bit.py @@ -12,13 +12,12 @@ """Test QuantumCircuit.find_bit.""" - from ddt import ddt, data, unpack from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit from qiskit.circuit import Qubit, Clbit, AncillaRegister from qiskit.circuit.exceptions import CircuitError -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/test_circuit_load_from_qpy.py b/test/python/circuit/test_circuit_load_from_qpy.py index 570b695c5922..5faf4704076a 100644 --- a/test/python/circuit/test_circuit_load_from_qpy.py +++ b/test/python/circuit/test_circuit_load_from_qpy.py @@ -50,12 +50,12 @@ from qiskit.circuit.parameter import Parameter from qiskit.circuit.parametervector import ParameterVector from qiskit.synthesis import LieTrotter, SuzukiTrotter -from qiskit.test import QiskitTestCase from qiskit.qpy import dump, load from qiskit.quantum_info import Pauli, SparsePauliOp, Clifford from qiskit.quantum_info.random import random_unitary from qiskit.circuit.controlledgate import ControlledGate from qiskit.utils import optionals +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt.ddt diff --git a/test/python/circuit/test_circuit_multi_registers.py b/test/python/circuit/test_circuit_multi_registers.py index 4bb66b323f01..1a88d4580763 100644 --- a/test/python/circuit/test_circuit_multi_registers.py +++ b/test/python/circuit/test_circuit_multi_registers.py @@ -14,8 +14,8 @@ """Test Qiskit's QuantumCircuit class for multiple registers.""" from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit from qiskit.converters.circuit_to_dag import circuit_to_dag -from qiskit.test import QiskitTestCase from qiskit.circuit.exceptions import CircuitError +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCircuitMultiRegs(QiskitTestCase): diff --git a/test/python/circuit/test_circuit_operations.py b/test/python/circuit/test_circuit_operations.py index f368acbc2980..f17a61d2e843 100644 --- a/test/python/circuit/test_circuit_operations.py +++ b/test/python/circuit/test_circuit_operations.py @@ -30,7 +30,7 @@ from qiskit.providers.basic_provider import BasicSimulator from qiskit.pulse import DriveChannel, Gaussian, Play, Schedule from qiskit.quantum_info import Operator -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/test_circuit_properties.py b/test/python/circuit/test_circuit_properties.py index da9af61367a8..9875739d3aa8 100644 --- a/test/python/circuit/test_circuit_properties.py +++ b/test/python/circuit/test_circuit_properties.py @@ -14,11 +14,12 @@ import unittest import numpy as np + from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, pulse from qiskit.circuit import Clbit from qiskit.circuit.library import RXGate, RYGate -from qiskit.test import QiskitTestCase from qiskit.circuit.exceptions import CircuitError +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCircuitProperties(QiskitTestCase): diff --git a/test/python/circuit/test_circuit_qasm.py b/test/python/circuit/test_circuit_qasm.py index fbe6d79f78b6..121ad7222f4e 100644 --- a/test/python/circuit/test_circuit_qasm.py +++ b/test/python/circuit/test_circuit_qasm.py @@ -17,11 +17,11 @@ import re from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit -from qiskit.test import QiskitTestCase from qiskit.circuit import Parameter, Qubit, Clbit, Gate from qiskit.circuit.library import C3SXGate, CCZGate, CSGate, CSdgGate, PermutationGate from qiskit.qasm2.exceptions import QASM2Error as QasmError from qiskit.qasm2 import dumps +from test import QiskitTestCase # pylint: disable=wrong-import-order # Regex pattern to match valid OpenQASM identifiers VALID_QASM2_IDENTIFIER = re.compile("[a-z][a-zA-Z_0-9]*") diff --git a/test/python/circuit/test_circuit_registers.py b/test/python/circuit/test_circuit_registers.py index ca0ce6d0bed3..3de2a451877b 100644 --- a/test/python/circuit/test_circuit_registers.py +++ b/test/python/circuit/test_circuit_registers.py @@ -25,8 +25,8 @@ Gate, ) from qiskit.circuit.exceptions import CircuitError -from qiskit.test import QiskitTestCase from qiskit.qasm2 import dumps +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCircuitRegisters(QiskitTestCase): diff --git a/test/python/circuit/test_commutation_checker.py b/test/python/circuit/test_commutation_checker.py index bfb41e649a12..ac212bee40d3 100644 --- a/test/python/circuit/test_commutation_checker.py +++ b/test/python/circuit/test_commutation_checker.py @@ -13,11 +13,10 @@ """Test commutation checker class .""" import unittest + import numpy as np from qiskit import ClassicalRegister -from qiskit.test import QiskitTestCase - from qiskit.circuit import QuantumRegister, Parameter, Qubit from qiskit.circuit import CommutationChecker from qiskit.circuit.library import ( @@ -32,6 +31,7 @@ Reset, LinearFunction, ) +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCommutationChecker(QiskitTestCase): diff --git a/test/python/circuit/test_compose.py b/test/python/circuit/test_compose.py index 1c6d00915de1..7cf2be598d95 100644 --- a/test/python/circuit/test_compose.py +++ b/test/python/circuit/test_compose.py @@ -35,7 +35,7 @@ ) from qiskit.circuit.library import HGate, RZGate, CXGate, CCXGate, TwoLocal from qiskit.circuit.classical import expr -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCircuitCompose(QiskitTestCase): diff --git a/test/python/circuit/test_control_flow.py b/test/python/circuit/test_control_flow.py index e827b679a4a2..be5217b054a6 100644 --- a/test/python/circuit/test_control_flow.py +++ b/test/python/circuit/test_control_flow.py @@ -16,7 +16,6 @@ from ddt import ddt, data, unpack, idata -from qiskit.test import QiskitTestCase from qiskit.circuit import Clbit, ClassicalRegister, Instruction, Parameter, QuantumCircuit, Qubit from qiskit.circuit.classical import expr, types from qiskit.circuit.controlflow import CASE_DEFAULT, condition_resources, node_resources @@ -32,6 +31,7 @@ BreakLoopOp, SwitchCaseOp, ) +from test import QiskitTestCase # pylint: disable=wrong-import-order CONDITION_PARAMETRISATION = ( diff --git a/test/python/circuit/test_control_flow_builders.py b/test/python/circuit/test_control_flow_builders.py index 18df7fb6798f..6eea333abdf9 100644 --- a/test/python/circuit/test_control_flow_builders.py +++ b/test/python/circuit/test_control_flow_builders.py @@ -32,8 +32,8 @@ from qiskit.circuit.controlflow import ForLoopOp, IfElseOp, WhileLoopOp, SwitchCaseOp, CASE_DEFAULT from qiskit.circuit.controlflow.if_else import IfElsePlaceholder from qiskit.circuit.exceptions import CircuitError -from qiskit.test import QiskitTestCase -from qiskit.test._canonical import canonicalize_control_flow +from test import QiskitTestCase # pylint: disable=wrong-import-order +from test.utils._canonical import canonicalize_control_flow # pylint: disable=wrong-import-order class SentinelException(Exception): diff --git a/test/python/circuit/test_controlled_gate.py b/test/python/circuit/test_controlled_gate.py index 6eb64be60e5e..2ad4d4c11104 100644 --- a/test/python/circuit/test_controlled_gate.py +++ b/test/python/circuit/test_controlled_gate.py @@ -14,13 +14,11 @@ """Test Qiskit's controlled gate operation.""" import unittest -from test import combine import numpy as np from numpy import pi from ddt import ddt, data, unpack from qiskit import QuantumRegister, QuantumCircuit, QiskitError -from qiskit.test import QiskitTestCase from qiskit.circuit import ControlledGate, Parameter, Gate from qiskit.circuit.singleton import SingletonControlledGate, _SingletonControlledGateOverrides from qiskit.circuit.exceptions import CircuitError @@ -82,6 +80,8 @@ from qiskit.circuit.library.standard_gates.equivalence_library import ( StandardEquivalenceLibrary as std_eqlib, ) +from test import combine # pylint: disable=wrong-import-order +from test import QiskitTestCase # pylint: disable=wrong-import-order from .gate_utils import _get_free_params diff --git a/test/python/circuit/test_delay.py b/test/python/circuit/test_delay.py index f7b1d3f770d8..4259c5604606 100644 --- a/test/python/circuit/test_delay.py +++ b/test/python/circuit/test_delay.py @@ -15,11 +15,12 @@ """Test delay instruction for quantum circuits.""" import numpy as np + from qiskit.circuit import Delay from qiskit.circuit import Parameter, ParameterVector from qiskit.circuit import QuantumCircuit, CircuitInstruction from qiskit.circuit.exceptions import CircuitError -from qiskit.test.base import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestDelayClass(QiskitTestCase): diff --git a/test/python/circuit/test_diagonal_gate.py b/test/python/circuit/test_diagonal_gate.py index 983db8f64ad8..57a5d5966c7e 100644 --- a/test/python/circuit/test_diagonal_gate.py +++ b/test/python/circuit/test_diagonal_gate.py @@ -17,13 +17,12 @@ import numpy as np from qiskit import QuantumCircuit, assemble - from qiskit import QiskitError -from qiskit.test import QiskitTestCase from qiskit.compiler import transpile from qiskit.circuit.library.generalized_gates import DiagonalGate from qiskit.quantum_info.operators.predicates import matrix_equal from qiskit.quantum_info import Operator +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestDiagonalGate(QiskitTestCase): diff --git a/test/python/circuit/test_equivalence.py b/test/python/circuit/test_equivalence.py index 2a110f2726a3..bc2f3c957582 100644 --- a/test/python/circuit/test_equivalence.py +++ b/test/python/circuit/test_equivalence.py @@ -14,12 +14,10 @@ """Test Qiskit's EquivalenceLibrary class.""" import unittest -import numpy as np +import numpy as np import rustworkx as rx -from qiskit.test import QiskitTestCase - from qiskit.circuit import QuantumCircuit, Parameter, Gate from qiskit.circuit.library import U2Gate from qiskit.circuit.exceptions import CircuitError @@ -27,6 +25,7 @@ from qiskit.circuit import EquivalenceLibrary from qiskit.utils import optionals from qiskit.circuit.equivalence import Key, Equivalence, NodeData, EdgeData +from test import QiskitTestCase # pylint: disable=wrong-import-order from ..visualization.visualization import QiskitVisualizationTestCase, path_to_diagram_reference diff --git a/test/python/circuit/test_extensions_standard.py b/test/python/circuit/test_extensions_standard.py index 7fcc40d48525..73e00fa84c90 100644 --- a/test/python/circuit/test_extensions_standard.py +++ b/test/python/circuit/test_extensions_standard.py @@ -15,14 +15,13 @@ import unittest from inspect import signature from math import pi - import numpy as np from scipy.linalg import expm from ddt import data, ddt, unpack + from qiskit import ClassicalRegister, QuantumCircuit, QuantumRegister from qiskit.exceptions import QiskitError from qiskit.circuit.exceptions import CircuitError -from qiskit.test import QiskitTestCase from qiskit.circuit import Gate, ControlledGate from qiskit.circuit.library import ( U1Gate, @@ -42,6 +41,7 @@ from qiskit.utils.optionals import HAS_TWEEDLEDUM from qiskit.quantum_info import Operator from qiskit import transpile +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestStandard1Q(QiskitTestCase): diff --git a/test/python/circuit/test_gate_definitions.py b/test/python/circuit/test_gate_definitions.py index c12253f81f99..16d4b6eecd48 100644 --- a/test/python/circuit/test_gate_definitions.py +++ b/test/python/circuit/test_gate_definitions.py @@ -20,9 +20,7 @@ from qiskit import QuantumCircuit, QuantumRegister from qiskit.quantum_info import Operator -from qiskit.test import QiskitTestCase from qiskit.circuit import ParameterVector, Gate, ControlledGate - from qiskit.circuit.library import standard_gates from qiskit.circuit.library import ( HGate, @@ -64,10 +62,11 @@ RVGate, XXMinusYYGate, ) - from qiskit.circuit.library.standard_gates.equivalence_library import ( StandardEquivalenceLibrary as std_eqlib, ) +from test import QiskitTestCase # pylint: disable=wrong-import-order + from .gate_utils import _get_free_params diff --git a/test/python/circuit/test_gate_power.py b/test/python/circuit/test_gate_power.py index b10f16a80487..2dea1242ecaf 100644 --- a/test/python/circuit/test_gate_power.py +++ b/test/python/circuit/test_gate_power.py @@ -47,7 +47,7 @@ iSwapGate, ) from qiskit.quantum_info.operators import Operator -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/test_hamiltonian_gate.py b/test/python/circuit/test_hamiltonian_gate.py index 05648163a5c4..46aee007b158 100644 --- a/test/python/circuit/test_hamiltonian_gate.py +++ b/test/python/circuit/test_hamiltonian_gate.py @@ -16,14 +16,13 @@ import numpy as np from numpy.testing import assert_allclose - import qiskit from qiskit.circuit.library import HamiltonianGate -from qiskit.test import QiskitTestCase from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit from qiskit.circuit import Parameter from qiskit.quantum_info import Operator from qiskit.converters import circuit_to_dag, dag_to_circuit +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestHamiltonianGate(QiskitTestCase): diff --git a/test/python/circuit/test_identifiers_circuits.py b/test/python/circuit/test_identifiers_circuits.py index 06634fc4e104..aac476bc8130 100644 --- a/test/python/circuit/test_identifiers_circuits.py +++ b/test/python/circuit/test_identifiers_circuits.py @@ -16,7 +16,7 @@ from qiskit import ClassicalRegister, QuantumCircuit, QuantumRegister from qiskit.circuit.exceptions import CircuitError -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestAnonymousIds(QiskitTestCase): diff --git a/test/python/circuit/test_initializer.py b/test/python/circuit/test_initializer.py index 979401d3c9f7..122a4e4afe9a 100644 --- a/test/python/circuit/test_initializer.py +++ b/test/python/circuit/test_initializer.py @@ -29,8 +29,8 @@ from qiskit.providers.basic_provider import BasicSimulator from qiskit.quantum_info import state_fidelity, Statevector, Operator from qiskit.exceptions import QiskitError -from qiskit.test import QiskitTestCase from qiskit.circuit.library import Initialize +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/test_instruction_repeat.py b/test/python/circuit/test_instruction_repeat.py index 9cf50787d58d..2fa26af311fc 100644 --- a/test/python/circuit/test_instruction_repeat.py +++ b/test/python/circuit/test_instruction_repeat.py @@ -16,10 +16,10 @@ import unittest from qiskit import QuantumRegister, QuantumCircuit, ClassicalRegister -from qiskit.test import QiskitTestCase from qiskit.circuit.library import SGate, CXGate, UnitaryGate from qiskit.circuit import Instruction, Measure, Gate from qiskit.circuit.exceptions import CircuitError +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestRepeatInt1Q(QiskitTestCase): diff --git a/test/python/circuit/test_instructions.py b/test/python/circuit/test_instructions.py index 3643c4b126a2..6e9c2940c649 100644 --- a/test/python/circuit/test_instructions.py +++ b/test/python/circuit/test_instructions.py @@ -15,7 +15,6 @@ """Test Qiskit's Instruction class.""" import unittest.mock - import numpy as np from qiskit.circuit import ( @@ -32,9 +31,9 @@ ) from qiskit.circuit.library import HGate, RZGate, CXGate, SGate, TGate from qiskit.circuit.classical import expr -from qiskit.test import QiskitTestCase from qiskit.circuit.exceptions import CircuitError from qiskit.circuit.random import random_circuit +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestInstructions(QiskitTestCase): diff --git a/test/python/circuit/test_isometry.py b/test/python/circuit/test_isometry.py index ca987df64e14..a09ff331e02a 100644 --- a/test/python/circuit/test_isometry.py +++ b/test/python/circuit/test_isometry.py @@ -13,17 +13,16 @@ """Isometry tests.""" import unittest - import numpy as np from ddt import ddt, data from qiskit.quantum_info.random import random_unitary from qiskit import QuantumCircuit from qiskit import QuantumRegister -from qiskit.test import QiskitTestCase from qiskit.compiler import transpile from qiskit.quantum_info import Operator from qiskit.circuit.library.generalized_gates import Isometry +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/test_operation.py b/test/python/circuit/test_operation.py index f8989e644c59..650a7459a9e1 100644 --- a/test/python/circuit/test_operation.py +++ b/test/python/circuit/test_operation.py @@ -16,10 +16,10 @@ import numpy as np -from qiskit.test import QiskitTestCase from qiskit.circuit import QuantumCircuit, Barrier, Measure, Reset, Gate, Operation from qiskit.circuit.library import XGate, CXGate, Initialize, Isometry from qiskit.quantum_info.operators import Clifford, CNOTDihedral, Pauli +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestOperationClass(QiskitTestCase): diff --git a/test/python/circuit/test_parameters.py b/test/python/circuit/test_parameters.py index d216fa67deec..4a1e5f75bffd 100644 --- a/test/python/circuit/test_parameters.py +++ b/test/python/circuit/test_parameters.py @@ -11,15 +11,13 @@ # that they have been altered from the originals. """Test circuits with variable parameters.""" + import unittest import cmath import math import copy import pickle from operator import add, mul, sub, truediv - -from test import combine - import numpy from ddt import data, ddt, named_data @@ -33,10 +31,10 @@ from qiskit.compiler import assemble, transpile from qiskit import pulse from qiskit.quantum_info import Operator -from qiskit.test import QiskitTestCase from qiskit.providers.basic_provider import BasicSimulator from qiskit.providers.fake_provider import FakeOurense from qiskit.utils import parallel_map +from test import QiskitTestCase, combine # pylint: disable=wrong-import-order def raise_if_parameter_table_invalid(circuit): diff --git a/test/python/circuit/test_piecewise_polynomial.py b/test/python/circuit/test_piecewise_polynomial.py index 74b5387e56da..4233b513f5ff 100644 --- a/test/python/circuit/test_piecewise_polynomial.py +++ b/test/python/circuit/test_piecewise_polynomial.py @@ -17,12 +17,12 @@ import numpy as np from ddt import ddt, data, unpack -from qiskit.test.base import QiskitTestCase from qiskit.circuit import QuantumCircuit from qiskit.circuit.library.arithmetic.piecewise_polynomial_pauli_rotations import ( PiecewisePolynomialPauliRotations, ) from qiskit.quantum_info import Statevector +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/test_random_circuit.py b/test/python/circuit/test_random_circuit.py index d318c9c58578..a11ceb2a62e2 100644 --- a/test/python/circuit/test_random_circuit.py +++ b/test/python/circuit/test_random_circuit.py @@ -12,12 +12,11 @@ """Test random circuit generation utility.""" - from qiskit.circuit import QuantumCircuit, ClassicalRegister, Clbit from qiskit.circuit import Measure from qiskit.circuit.random import random_circuit from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCircuitRandom(QiskitTestCase): diff --git a/test/python/circuit/test_register.py b/test/python/circuit/test_register.py index d083e311ecbd..7f74e560ce29 100644 --- a/test/python/circuit/test_register.py +++ b/test/python/circuit/test_register.py @@ -16,13 +16,12 @@ from ddt import data, ddt -from qiskit.test import QiskitTestCase from qiskit.circuit import bit from qiskit.circuit import QuantumRegister from qiskit.circuit import AncillaRegister from qiskit.circuit import ClassicalRegister - from qiskit.circuit.exceptions import CircuitError +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/test_registerless_circuit.py b/test/python/circuit/test_registerless_circuit.py index 865b80e78034..3f77919957da 100644 --- a/test/python/circuit/test_registerless_circuit.py +++ b/test/python/circuit/test_registerless_circuit.py @@ -17,7 +17,7 @@ from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit from qiskit.circuit import Qubit, Clbit, AncillaQubit from qiskit.circuit.exceptions import CircuitError -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestRegisterlessCircuit(QiskitTestCase): diff --git a/test/python/circuit/test_scheduled_circuit.py b/test/python/circuit/test_scheduled_circuit.py index 8de46cfb4458..4ed3c87d0902 100644 --- a/test/python/circuit/test_scheduled_circuit.py +++ b/test/python/circuit/test_scheduled_circuit.py @@ -14,6 +14,7 @@ """Test scheduled circuit (quantum circuit with duration).""" from ddt import ddt, data + from qiskit import QuantumCircuit, QiskitError from qiskit import transpile, assemble from qiskit.circuit import Parameter @@ -21,8 +22,7 @@ from qiskit.providers.fake_provider import FakeParis from qiskit.transpiler.exceptions import TranspilerError from qiskit.transpiler.instruction_durations import InstructionDurations - -from qiskit.test.base import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/test_singleton.py b/test/python/circuit/test_singleton.py index ebc656f8d933..40549dd0ad15 100644 --- a/test/python/circuit/test_singleton.py +++ b/test/python/circuit/test_singleton.py @@ -40,8 +40,7 @@ from qiskit.circuit import Clbit, QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit.circuit.singleton import SingletonGate from qiskit.converters import dag_to_circuit, circuit_to_dag - -from qiskit.test.base import QiskitTestCase +from test.utils.base import QiskitTestCase # pylint: disable=wrong-import-order class TestSingleton(QiskitTestCase): diff --git a/test/python/circuit/test_templates.py b/test/python/circuit/test_templates.py index 362f306ff30b..06853827b03f 100644 --- a/test/python/circuit/test_templates.py +++ b/test/python/circuit/test_templates.py @@ -13,16 +13,16 @@ """Tests for circuit templates.""" import unittest -from test import combine from inspect import getmembers, isfunction from ddt import ddt import numpy as np from qiskit import QuantumCircuit -from qiskit.test import QiskitTestCase from qiskit.quantum_info.operators import Operator import qiskit.circuit.library.templates as templib +from test import combine # pylint: disable=wrong-import-order +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/test_tensor.py b/test/python/circuit/test_tensor.py index 442cfbb4ccd5..be2b70440be8 100644 --- a/test/python/circuit/test_tensor.py +++ b/test/python/circuit/test_tensor.py @@ -16,8 +16,8 @@ from qiskit.circuit import QuantumRegister, ClassicalRegister, QuantumCircuit, Parameter from qiskit.circuit.exceptions import CircuitError -from qiskit.test import QiskitTestCase from qiskit.quantum_info import Operator +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCircuitCompose(QiskitTestCase): diff --git a/test/python/circuit/test_tools.py b/test/python/circuit/test_tools.py index 8496b825f56d..7a218082f055 100644 --- a/test/python/circuit/test_tools.py +++ b/test/python/circuit/test_tools.py @@ -16,9 +16,10 @@ from test import combine from ddt import ddt from numpy import pi -from qiskit.test import QiskitTestCase + from qiskit.circuit.tools.pi_check import pi_check from qiskit.circuit import Parameter +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/circuit/test_uc.py b/test/python/circuit/test_uc.py index af49743485ac..87541d349c3f 100644 --- a/test/python/circuit/test_uc.py +++ b/test/python/circuit/test_uc.py @@ -16,21 +16,18 @@ """ import unittest - from ddt import ddt from test import combine # pylint: disable=wrong-import-order - import numpy as np from scipy.linalg import block_diag from qiskit.circuit.library.generalized_gates import UCGate - from qiskit import QuantumCircuit, QuantumRegister -from qiskit.test import QiskitTestCase from qiskit.quantum_info.random import random_unitary from qiskit.compiler import transpile from qiskit.quantum_info.operators.predicates import matrix_equal from qiskit.quantum_info import Operator +from test import QiskitTestCase # pylint: disable=wrong-import-order _id = np.eye(2, 2) _not = np.matrix([[0, 1], [1, 0]]) diff --git a/test/python/circuit/test_ucx_y_z.py b/test/python/circuit/test_ucx_y_z.py index af4e33c228ea..e40604576c97 100644 --- a/test/python/circuit/test_ucx_y_z.py +++ b/test/python/circuit/test_ucx_y_z.py @@ -14,17 +14,15 @@ import itertools import unittest - import numpy as np from scipy.linalg import block_diag from qiskit import QuantumCircuit, QuantumRegister -from qiskit.test import QiskitTestCase - from qiskit.quantum_info.operators.predicates import matrix_equal from qiskit.quantum_info import Operator from qiskit.compiler import transpile from qiskit.circuit.library import UCRXGate, UCRYGate, UCRZGate +from test import QiskitTestCase # pylint: disable=wrong-import-order angles_list = [ [0], diff --git a/test/python/circuit/test_unitary.py b/test/python/circuit/test_unitary.py index 26f3eb3fea2e..3c6cd22567a2 100644 --- a/test/python/circuit/test_unitary.py +++ b/test/python/circuit/test_unitary.py @@ -18,7 +18,6 @@ import qiskit from qiskit.circuit.library import UnitaryGate -from qiskit.test import QiskitTestCase from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit from qiskit.transpiler import PassManager from qiskit.converters import circuit_to_dag, dag_to_circuit @@ -26,6 +25,7 @@ from qiskit.quantum_info.operators import Operator from qiskit.transpiler.passes import CXCancellation from qiskit.qasm2 import dumps +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestUnitaryGate(QiskitTestCase): diff --git a/test/python/classical_function_compiler/test_boolean_expression.py b/test/python/classical_function_compiler/test_boolean_expression.py index b5445af29dce..afdc91fdd04f 100644 --- a/test/python/classical_function_compiler/test_boolean_expression.py +++ b/test/python/classical_function_compiler/test_boolean_expression.py @@ -16,10 +16,10 @@ from os import path from ddt import ddt, unpack, data -from qiskit.test.base import QiskitTestCase from qiskit import transpile from qiskit.providers.basic_provider import BasicSimulator from qiskit.utils.optionals import HAS_TWEEDLEDUM +from test import QiskitTestCase # pylint: disable=wrong-import-order if HAS_TWEEDLEDUM: from qiskit.circuit.classicalfunction.boolean_expression import BooleanExpression diff --git a/test/python/classical_function_compiler/test_classical_function.py b/test/python/classical_function_compiler/test_classical_function.py index 66bd5e1a755b..d4a0bf66d493 100644 --- a/test/python/classical_function_compiler/test_classical_function.py +++ b/test/python/classical_function_compiler/test_classical_function.py @@ -11,13 +11,13 @@ # that they have been altered from the originals. """Tests ClassicalFunction as a gate.""" -import unittest -from qiskit.test import QiskitTestCase +import unittest from qiskit import QuantumCircuit from qiskit.circuit.library.standard_gates import XGate from qiskit.utils.optionals import HAS_TWEEDLEDUM +from test import QiskitTestCase # pylint: disable=wrong-import-order if HAS_TWEEDLEDUM: from . import examples diff --git a/test/python/classical_function_compiler/test_parse.py b/test/python/classical_function_compiler/test_parse.py index a10b6ad43847..15862ca71b3a 100644 --- a/test/python/classical_function_compiler/test_parse.py +++ b/test/python/classical_function_compiler/test_parse.py @@ -11,10 +11,11 @@ # that they have been altered from the originals. """Tests the classicalfunction parser.""" + import unittest -from qiskit.test import QiskitTestCase from qiskit.utils.optionals import HAS_TWEEDLEDUM +from test import QiskitTestCase # pylint: disable=wrong-import-order if HAS_TWEEDLEDUM: from . import bad_examples as examples diff --git a/test/python/classical_function_compiler/test_simulate.py b/test/python/classical_function_compiler/test_simulate.py index 732f9f36c115..65399de82d08 100644 --- a/test/python/classical_function_compiler/test_simulate.py +++ b/test/python/classical_function_compiler/test_simulate.py @@ -11,10 +11,11 @@ # that they have been altered from the originals. """Tests LogicNetwork.simulate method.""" + import unittest from ddt import ddt, data -from qiskit.test import QiskitTestCase from qiskit.utils.optionals import HAS_TWEEDLEDUM +from test import QiskitTestCase # pylint: disable=wrong-import-order from . import utils diff --git a/test/python/classical_function_compiler/test_synthesis.py b/test/python/classical_function_compiler/test_synthesis.py index 76daba7d9897..3b8890d986ce 100644 --- a/test/python/classical_function_compiler/test_synthesis.py +++ b/test/python/classical_function_compiler/test_synthesis.py @@ -11,13 +11,13 @@ # that they have been altered from the originals. """Tests classicalfunction compiler synthesis.""" -import unittest -from qiskit.test import QiskitTestCase +import unittest from qiskit import QuantumCircuit, QuantumRegister from qiskit.circuit.library.standard_gates import XGate from qiskit.utils.optionals import HAS_TWEEDLEDUM +from test import QiskitTestCase # pylint: disable=wrong-import-order if HAS_TWEEDLEDUM: from qiskit.circuit.classicalfunction import classical_function as compile_classical_function diff --git a/test/python/classical_function_compiler/test_tweedledum2qiskit.py b/test/python/classical_function_compiler/test_tweedledum2qiskit.py index 488ad4061304..32bd9485fdc2 100644 --- a/test/python/classical_function_compiler/test_tweedledum2qiskit.py +++ b/test/python/classical_function_compiler/test_tweedledum2qiskit.py @@ -11,13 +11,13 @@ # that they have been altered from the originals. """Tests LogicNetwork.Tweedledum2Qiskit converter.""" + import unittest from qiskit.utils.optionals import HAS_TWEEDLEDUM -from qiskit.test import QiskitTestCase - from qiskit import QuantumCircuit, QuantumRegister from qiskit.circuit.library.standard_gates import XGate +from test import QiskitTestCase # pylint: disable=wrong-import-order if HAS_TWEEDLEDUM: # pylint: disable=import-error diff --git a/test/python/classical_function_compiler/test_typecheck.py b/test/python/classical_function_compiler/test_typecheck.py index 9155063c3497..36b64ce4fd4d 100644 --- a/test/python/classical_function_compiler/test_typecheck.py +++ b/test/python/classical_function_compiler/test_typecheck.py @@ -11,10 +11,11 @@ # that they have been altered from the originals. """Tests classicalfunction compiler type checker.""" + import unittest -from qiskit.test import QiskitTestCase from qiskit.utils.optionals import HAS_TWEEDLEDUM +from test import QiskitTestCase # pylint: disable=wrong-import-order if HAS_TWEEDLEDUM: from . import examples, bad_examples diff --git a/test/python/classical_function_compiler/test_utils.py b/test/python/classical_function_compiler/test_utils.py index 70dd6616aeda..6d69e0d8e6cc 100644 --- a/test/python/classical_function_compiler/test_utils.py +++ b/test/python/classical_function_compiler/test_utils.py @@ -10,10 +10,12 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. """Tests .utils.get_truthtable_from_function function""" + import unittest -from qiskit.test import QiskitTestCase from qiskit.utils.optionals import HAS_TWEEDLEDUM +from test import QiskitTestCase # pylint: disable=wrong-import-order + from .utils import get_truthtable_from_function from . import examples diff --git a/test/python/compiler/test_assembler.py b/test/python/compiler/test_assembler.py index 56f7e90b7af8..ea9fce29970a 100644 --- a/test/python/compiler/test_assembler.py +++ b/test/python/compiler/test_assembler.py @@ -17,8 +17,8 @@ from logging import StreamHandler, getLogger import sys import copy - import numpy as np + from qiskit import pulse from qiskit.circuit import Instruction, Gate, Parameter, ParameterVector from qiskit.circuit import QuantumRegister, ClassicalRegister, QuantumCircuit @@ -30,13 +30,13 @@ from qiskit.qobj import QasmQobj, PulseQobj from qiskit.qobj.utils import MeasLevel, MeasReturnType from qiskit.pulse.macros import measure -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import ( FakeOpenPulse2Q, FakeOpenPulse3Q, FakeYorktown, FakeHanoi, ) +from test import QiskitTestCase # pylint: disable=wrong-import-order class RxGate(Gate): diff --git a/test/python/compiler/test_compiler.py b/test/python/compiler/test_compiler.py index efa4b90b77a4..dac3f890ca32 100644 --- a/test/python/compiler/test_compiler.py +++ b/test/python/compiler/test_compiler.py @@ -19,11 +19,11 @@ from qiskit.transpiler import PassManager from qiskit.circuit.library import U1Gate, U2Gate from qiskit.compiler import transpile, assemble -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeRueschlikon, FakeTenerife from qiskit.providers.basic_provider import BasicSimulator from qiskit.qobj import QasmQobj from qiskit.qasm2 import dumps +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCompiler(QiskitTestCase): diff --git a/test/python/compiler/test_disassembler.py b/test/python/compiler/test_disassembler.py index 024ede19b628..e575c021adca 100644 --- a/test/python/compiler/test_disassembler.py +++ b/test/python/compiler/test_disassembler.py @@ -26,9 +26,9 @@ from qiskit.circuit.library import RXGate, Isometry from qiskit.pulse.transforms import target_qobj_transform -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeOpenPulse2Q import qiskit.quantum_info as qi +from test import QiskitTestCase # pylint: disable=wrong-import-order def _parametric_to_waveforms(schedule): diff --git a/test/python/compiler/test_scheduler.py b/test/python/compiler/test_scheduler.py index bb3379d490bc..62e0af596ba4 100644 --- a/test/python/compiler/test_scheduler.py +++ b/test/python/compiler/test_scheduler.py @@ -15,9 +15,9 @@ from qiskit.circuit import QuantumRegister, ClassicalRegister, QuantumCircuit from qiskit.exceptions import QiskitError from qiskit.pulse import InstructionScheduleMap, Schedule -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeOpenPulse3Q from qiskit.compiler.scheduler import schedule +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCircuitScheduler(QiskitTestCase): diff --git a/test/python/compiler/test_sequencer.py b/test/python/compiler/test_sequencer.py index d065bff42e5f..e0b635dfeb86 100644 --- a/test/python/compiler/test_sequencer.py +++ b/test/python/compiler/test_sequencer.py @@ -19,8 +19,7 @@ from qiskit.compiler import sequence, transpile, schedule from qiskit.pulse.transforms import pad from qiskit.providers.fake_provider import FakeParis - -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestSequence(QiskitTestCase): diff --git a/test/python/compiler/test_transpiler.py b/test/python/compiler/test_transpiler.py index 6e53ea091e47..71c0eceef43c 100644 --- a/test/python/compiler/test_transpiler.py +++ b/test/python/compiler/test_transpiler.py @@ -19,10 +19,7 @@ import sys import unittest from logging import StreamHandler, getLogger - -from test import combine # pylint: disable=wrong-import-order from unittest.mock import patch - import numpy as np import rustworkx as rx from ddt import data, ddt, unpack @@ -88,7 +85,6 @@ from qiskit.providers.basic_provider import BasicSimulator from qiskit.pulse import InstructionScheduleMap from qiskit.quantum_info import Operator, random_unitary -from qiskit.test import QiskitTestCase, slow_test from qiskit.utils import parallel from qiskit.transpiler import CouplingMap, Layout, PassManager, TransformationPass from qiskit.transpiler.exceptions import TranspilerError, CircuitTooWideForTarget @@ -96,6 +92,7 @@ from qiskit.transpiler.passmanager_config import PassManagerConfig from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager, level_0_pass_manager from qiskit.transpiler.target import InstructionProperties, Target +from test import QiskitTestCase, combine, slow_test # pylint: disable=wrong-import-order class CustomCX(Gate): diff --git a/test/python/converters/test_circuit_to_dag.py b/test/python/converters/test_circuit_to_dag.py index 7b8d7946dd0b..4f2f52d03780 100644 --- a/test/python/converters/test_circuit_to_dag.py +++ b/test/python/converters/test_circuit_to_dag.py @@ -19,7 +19,7 @@ from qiskit.circuit.library import HGate, Measure from qiskit.circuit.classical import expr from qiskit.converters import dag_to_circuit, circuit_to_dag -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCircuitToDag(QiskitTestCase): diff --git a/test/python/converters/test_circuit_to_dagdependency.py b/test/python/converters/test_circuit_to_dagdependency.py index fcc208812478..9d33192d50a1 100644 --- a/test/python/converters/test_circuit_to_dagdependency.py +++ b/test/python/converters/test_circuit_to_dagdependency.py @@ -18,7 +18,7 @@ from qiskit.converters.dagdependency_to_circuit import dagdependency_to_circuit from qiskit.converters.circuit_to_dagdependency import circuit_to_dagdependency from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCircuitToDagCanonical(QiskitTestCase): diff --git a/test/python/converters/test_circuit_to_gate.py b/test/python/converters/test_circuit_to_gate.py index 43ff8dc6469d..de3ad079e566 100644 --- a/test/python/converters/test_circuit_to_gate.py +++ b/test/python/converters/test_circuit_to_gate.py @@ -19,8 +19,8 @@ from qiskit import QuantumRegister, QuantumCircuit from qiskit.circuit import Gate, Qubit from qiskit.quantum_info import Operator -from qiskit.test import QiskitTestCase from qiskit.exceptions import QiskitError +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCircuitToGate(QiskitTestCase): diff --git a/test/python/converters/test_circuit_to_instruction.py b/test/python/converters/test_circuit_to_instruction.py index 218031c9e842..56a227dbad92 100644 --- a/test/python/converters/test_circuit_to_instruction.py +++ b/test/python/converters/test_circuit_to_instruction.py @@ -22,8 +22,8 @@ from qiskit.circuit import Qubit, Clbit, Instruction from qiskit.circuit import Parameter from qiskit.quantum_info import Operator -from qiskit.test import QiskitTestCase from qiskit.exceptions import QiskitError +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCircuitToInstruction(QiskitTestCase): diff --git a/test/python/converters/test_dag_to_dagdependency.py b/test/python/converters/test_dag_to_dagdependency.py index 5523a4b47b25..6b52652e6ace 100644 --- a/test/python/converters/test_dag_to_dagdependency.py +++ b/test/python/converters/test_dag_to_dagdependency.py @@ -19,7 +19,7 @@ from qiskit.converters.dag_to_dagdependency import dag_to_dagdependency from qiskit.converters.dagdependency_to_dag import dagdependency_to_dag from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCircuitToDagDependency(QiskitTestCase): diff --git a/test/python/dagcircuit/test_collect_blocks.py b/test/python/dagcircuit/test_collect_blocks.py index 2cfae5486083..2fe3e4bad7bf 100644 --- a/test/python/dagcircuit/test_collect_blocks.py +++ b/test/python/dagcircuit/test_collect_blocks.py @@ -23,9 +23,9 @@ dag_to_circuit, dagdependency_to_circuit, ) -from qiskit.test import QiskitTestCase from qiskit.circuit import QuantumCircuit, Measure, Clbit from qiskit.dagcircuit.collect_blocks import BlockCollector, BlockSplitter, BlockCollapser +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCollectBlocks(QiskitTestCase): diff --git a/test/python/dagcircuit/test_compose.py b/test/python/dagcircuit/test_compose.py index 0a1702d8cbf9..c2862eb200fe 100644 --- a/test/python/dagcircuit/test_compose.py +++ b/test/python/dagcircuit/test_compose.py @@ -26,9 +26,9 @@ from qiskit.circuit.classical import expr, types from qiskit.dagcircuit import DAGCircuit from qiskit.converters import circuit_to_dag, dag_to_circuit -from qiskit.test import QiskitTestCase from qiskit.pulse import Schedule from qiskit.circuit.gate import Gate +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestDagCompose(QiskitTestCase): diff --git a/test/python/dagcircuit/test_dagcircuit.py b/test/python/dagcircuit/test_dagcircuit.py index b539ff3d5da3..3fcf5ff7a27e 100644 --- a/test/python/dagcircuit/test_dagcircuit.py +++ b/test/python/dagcircuit/test_dagcircuit.py @@ -18,7 +18,6 @@ import unittest from ddt import ddt, data - import rustworkx as rx from numpy import pi @@ -43,7 +42,7 @@ from qiskit.circuit.classical import expr from qiskit.circuit.library import IGate, HGate, CXGate, CZGate, XGate, YGate, U1Gate, RXGate from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order def raise_if_dagcircuit_invalid(dag): diff --git a/test/python/dagcircuit/test_dagdependency.py b/test/python/dagcircuit/test_dagdependency.py index ca6890bb40a3..d9d44cc7b2a4 100644 --- a/test/python/dagcircuit/test_dagdependency.py +++ b/test/python/dagcircuit/test_dagdependency.py @@ -21,7 +21,7 @@ from qiskit.circuit.library.standard_gates.h import HGate from qiskit.dagcircuit.exceptions import DAGDependencyError from qiskit.converters import circuit_to_dagdependency -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order try: import rustworkx as rx diff --git a/test/python/passmanager/__init__.py b/test/python/passmanager/__init__.py index d5b924250dc4..53f9f80a621d 100644 --- a/test/python/passmanager/__init__.py +++ b/test/python/passmanager/__init__.py @@ -18,7 +18,7 @@ from itertools import zip_longest from logging import getLogger -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class PassManagerTestCase(QiskitTestCase): diff --git a/test/python/primitives/containers/test_bindings_array.py b/test/python/primitives/containers/test_bindings_array.py index 4affdcd41102..b15e16b214c7 100644 --- a/test/python/primitives/containers/test_bindings_array.py +++ b/test/python/primitives/containers/test_bindings_array.py @@ -17,7 +17,7 @@ from qiskit.circuit import Parameter, ParameterVector, QuantumCircuit from qiskit.primitives import BindingsArray -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt.ddt diff --git a/test/python/primitives/containers/test_bit_array.py b/test/python/primitives/containers/test_bit_array.py index f9abf5d845e2..77b62fe18cc6 100644 --- a/test/python/primitives/containers/test_bit_array.py +++ b/test/python/primitives/containers/test_bit_array.py @@ -19,7 +19,7 @@ from qiskit.primitives.containers import BitArray from qiskit.result import Counts -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order def u_8(arr): diff --git a/test/python/primitives/containers/test_data_bin.py b/test/python/primitives/containers/test_data_bin.py index ccfef56bd554..59ba1cd71f1d 100644 --- a/test/python/primitives/containers/test_data_bin.py +++ b/test/python/primitives/containers/test_data_bin.py @@ -19,7 +19,7 @@ from qiskit.primitives.containers import make_data_bin from qiskit.primitives.containers.data_bin import DataBin, DataBinMeta -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class DataBinTestCase(QiskitTestCase): diff --git a/test/python/primitives/containers/test_estimator_pub.py b/test/python/primitives/containers/test_estimator_pub.py index 559b6bd3c4d4..dcd2114f35cf 100644 --- a/test/python/primitives/containers/test_estimator_pub.py +++ b/test/python/primitives/containers/test_estimator_pub.py @@ -17,7 +17,7 @@ from qiskit.circuit import QuantumCircuit, Parameter from qiskit.primitives.containers import BindingsArray, EstimatorPub, ObservablesArray -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt.ddt diff --git a/test/python/primitives/containers/test_observables_array.py b/test/python/primitives/containers/test_observables_array.py index cd0c4473d7c4..21af91036777 100644 --- a/test/python/primitives/containers/test_observables_array.py +++ b/test/python/primitives/containers/test_observables_array.py @@ -13,13 +13,12 @@ """Test ObservablesArray""" import itertools as it - import ddt import numpy as np import qiskit.quantum_info as qi from qiskit.primitives import ObservablesArray -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt.ddt diff --git a/test/python/primitives/containers/test_primitive_result.py b/test/python/primitives/containers/test_primitive_result.py index 25b2f505b21f..79200d2cb19d 100644 --- a/test/python/primitives/containers/test_primitive_result.py +++ b/test/python/primitives/containers/test_primitive_result.py @@ -17,7 +17,7 @@ import numpy.typing as npt from qiskit.primitives.containers import PrimitiveResult, PubResult, make_data_bin -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class PrimitiveResultCase(QiskitTestCase): diff --git a/test/python/primitives/containers/test_pub_result.py b/test/python/primitives/containers/test_pub_result.py index 5144cc2db73f..1849b77c4757 100644 --- a/test/python/primitives/containers/test_pub_result.py +++ b/test/python/primitives/containers/test_pub_result.py @@ -14,7 +14,7 @@ """Unit tests for PubResult.""" from qiskit.primitives.containers import PubResult, make_data_bin -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class PubResultCase(QiskitTestCase): diff --git a/test/python/primitives/containers/test_sampler_pub.py b/test/python/primitives/containers/test_sampler_pub.py index 7f1353413701..42fb04afc560 100644 --- a/test/python/primitives/containers/test_sampler_pub.py +++ b/test/python/primitives/containers/test_sampler_pub.py @@ -17,7 +17,7 @@ from qiskit.circuit import QuantumCircuit, Parameter from qiskit.primitives.containers import SamplerPub, BindingsArray -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt.ddt diff --git a/test/python/primitives/containers/test_shape.py b/test/python/primitives/containers/test_shape.py index c9c315613e24..a5c80524647d 100644 --- a/test/python/primitives/containers/test_shape.py +++ b/test/python/primitives/containers/test_shape.py @@ -16,7 +16,7 @@ import numpy as np from qiskit.primitives.containers.shape import Shaped, ShapedMixin, array_coerce, shape_tuple -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class DummyShaped(ShapedMixin): diff --git a/test/python/primitives/test_backend_estimator.py b/test/python/primitives/test_backend_estimator.py index 659765ec89b5..d1a81b9ea871 100644 --- a/test/python/primitives/test_backend_estimator.py +++ b/test/python/primitives/test_backend_estimator.py @@ -15,10 +15,6 @@ import unittest from unittest.mock import patch from multiprocessing import Manager - -from test import combine -from test.python.transpiler._dummy_passes import DummyAP - import numpy as np from ddt import ddt @@ -28,9 +24,12 @@ from qiskit.providers.fake_provider import FakeNairobi, FakeNairobiV2 from qiskit.providers.fake_provider.fake_backend_v2 import FakeBackendSimple from qiskit.quantum_info import SparsePauliOp -from qiskit.test import QiskitTestCase from qiskit.transpiler import PassManager from qiskit.utils import optionals +from test import QiskitTestCase # pylint: disable=wrong-import-order +from test import combine # pylint: disable=wrong-import-order +from test.python.transpiler._dummy_passes import DummyAP # pylint: disable=wrong-import-order + BACKENDS = [FakeNairobi(), FakeNairobiV2(), FakeBackendSimple()] diff --git a/test/python/primitives/test_backend_sampler.py b/test/python/primitives/test_backend_sampler.py index e485c74b0b00..f80f06b71529 100644 --- a/test/python/primitives/test_backend_sampler.py +++ b/test/python/primitives/test_backend_sampler.py @@ -15,10 +15,6 @@ import math import unittest from multiprocessing import Manager - -from test import combine -from test.python.transpiler._dummy_passes import DummyAP - import numpy as np from ddt import ddt @@ -28,9 +24,12 @@ from qiskit.providers import JobStatus from qiskit.providers.fake_provider import FakeNairobi, FakeNairobiV2 from qiskit.providers.basic_provider import BasicSimulator -from qiskit.test import QiskitTestCase from qiskit.transpiler import PassManager from qiskit.utils import optionals +from test import QiskitTestCase # pylint: disable=wrong-import-order +from test import combine # pylint: disable=wrong-import-order +from test.python.transpiler._dummy_passes import DummyAP # pylint: disable=wrong-import-order + BACKENDS = [FakeNairobi(), FakeNairobiV2()] diff --git a/test/python/primitives/test_estimator.py b/test/python/primitives/test_estimator.py index 2ee108a03a6d..cfba5132aac4 100644 --- a/test/python/primitives/test_estimator.py +++ b/test/python/primitives/test_estimator.py @@ -24,7 +24,7 @@ from qiskit.primitives.base import validation from qiskit.primitives.utils import _observable_key from qiskit.quantum_info import Operator, Pauli, PauliList, SparsePauliOp -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestEstimator(QiskitTestCase): diff --git a/test/python/primitives/test_primitive.py b/test/python/primitives/test_primitive.py index 5ae93df82a51..65d3493fc679 100644 --- a/test/python/primitives/test_primitive.py +++ b/test/python/primitives/test_primitive.py @@ -22,7 +22,7 @@ from qiskit.primitives.base import validation from qiskit.primitives.utils import _circuit_key from qiskit.providers.fake_provider import FakeAlmaden -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/primitives/test_result.py b/test/python/primitives/test_result.py index 3f4904ada58f..704b0fd4c2b4 100644 --- a/test/python/primitives/test_result.py +++ b/test/python/primitives/test_result.py @@ -17,11 +17,10 @@ from collections.abc import Collection from dataclasses import dataclass from typing import Any - from ddt import data, ddt, unpack from qiskit.primitives.base.base_result import BasePrimitiveResult -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order ################################################################################ diff --git a/test/python/primitives/test_sampler.py b/test/python/primitives/test_sampler.py index 67ea3124df30..1ebfed5e2685 100644 --- a/test/python/primitives/test_sampler.py +++ b/test/python/primitives/test_sampler.py @@ -13,7 +13,6 @@ """Tests for Sampler.""" import unittest - import numpy as np from qiskit import QuantumCircuit @@ -21,7 +20,7 @@ from qiskit.circuit.library import RealAmplitudes, UnitaryGate from qiskit.primitives import Sampler, SamplerResult from qiskit.providers import JobStatus -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestSampler(QiskitTestCase): diff --git a/test/python/primitives/test_statevector_estimator.py b/test/python/primitives/test_statevector_estimator.py index 28c46ce8e0f1..a3fc52bbc887 100644 --- a/test/python/primitives/test_statevector_estimator.py +++ b/test/python/primitives/test_statevector_estimator.py @@ -20,7 +20,7 @@ from qiskit.circuit.library import RealAmplitudes from qiskit.primitives import BindingsArray, EstimatorPub, ObservablesArray, StatevectorEstimator from qiskit.quantum_info import SparsePauliOp -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestStatevectorEstimator(QiskitTestCase): diff --git a/test/python/primitives/test_statevector_sampler.py b/test/python/primitives/test_statevector_sampler.py index 06317c02d7a4..fa6ba20a2622 100644 --- a/test/python/primitives/test_statevector_sampler.py +++ b/test/python/primitives/test_statevector_sampler.py @@ -28,7 +28,7 @@ from qiskit.primitives.containers.data_bin import DataBin from qiskit.primitives.statevector_sampler import StatevectorSampler from qiskit.providers import JobStatus -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestStatevectorSampler(QiskitTestCase): diff --git a/test/python/primitives/test_utils.py b/test/python/primitives/test_utils.py index c158ae05c037..9f1c53091f2f 100644 --- a/test/python/primitives/test_utils.py +++ b/test/python/primitives/test_utils.py @@ -14,7 +14,7 @@ from qiskit import ClassicalRegister, QuantumCircuit, QuantumRegister from qiskit.primitives.utils import final_measurement_mapping -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestMapping(QiskitTestCase): diff --git a/test/python/providers/basic_provider/test_basic_provider_backends.py b/test/python/providers/basic_provider/test_basic_provider_backends.py index 4aa229515ef7..d761015d04e1 100644 --- a/test/python/providers/basic_provider/test_basic_provider_backends.py +++ b/test/python/providers/basic_provider/test_basic_provider_backends.py @@ -14,7 +14,7 @@ from qiskit.providers.basic_provider.basic_provider import BasicProvider from qiskit.providers.exceptions import QiskitBackendNotFoundError -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestBasicProviderBackends(QiskitTestCase): diff --git a/test/python/providers/basic_provider/test_basic_provider_integration.py b/test/python/providers/basic_provider/test_basic_provider_integration.py index 191ff9fba22b..ec144ed3e673 100644 --- a/test/python/providers/basic_provider/test_basic_provider_integration.py +++ b/test/python/providers/basic_provider/test_basic_provider_integration.py @@ -17,7 +17,7 @@ from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, transpile from qiskit.result import Result from qiskit.providers.basic_provider import BasicProviderError, BasicSimulator -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestBasicProviderIntegration(QiskitTestCase): diff --git a/test/python/providers/basic_provider/test_basic_simulator.py b/test/python/providers/basic_provider/test_basic_simulator.py index a667005114ea..282b23c1b2a5 100644 --- a/test/python/providers/basic_provider/test_basic_simulator.py +++ b/test/python/providers/basic_provider/test_basic_simulator.py @@ -14,14 +14,14 @@ import os import unittest - import numpy as np from qiskit import ClassicalRegister, QuantumCircuit, QuantumRegister from qiskit.compiler import transpile, assemble from qiskit.providers.basic_provider import BasicSimulator -from qiskit.test import QiskitTestCase from qiskit.qasm2 import dumps +from test import QiskitTestCase # pylint: disable=wrong-import-order + from . import BasicProviderBackendTestMixin diff --git a/test/python/providers/basic_provider/test_multi_registers_convention.py b/test/python/providers/basic_provider/test_multi_registers_convention.py index 700ab8aec675..a6d114f6b5b7 100644 --- a/test/python/providers/basic_provider/test_multi_registers_convention.py +++ b/test/python/providers/basic_provider/test_multi_registers_convention.py @@ -14,7 +14,7 @@ from qiskit import ClassicalRegister, QuantumCircuit, QuantumRegister from qiskit.providers.basic_provider import BasicProvider -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCircuitMultiRegs(QiskitTestCase): diff --git a/test/python/providers/fake_provider/test_fake_backends.py b/test/python/providers/fake_provider/test_fake_backends.py index da334b326919..ce5fd565c09a 100644 --- a/test/python/providers/fake_provider/test_fake_backends.py +++ b/test/python/providers/fake_provider/test_fake_backends.py @@ -15,9 +15,9 @@ import unittest from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, transpile -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeAthens, FakePerth from qiskit.utils import optionals +from test import QiskitTestCase # pylint: disable=wrong-import-order def get_test_circuit(): diff --git a/test/python/providers/fake_provider/test_fake_generic.py b/test/python/providers/fake_provider/test_fake_generic.py index 0c9740f3a285..1d8d41bb86d7 100644 --- a/test/python/providers/fake_provider/test_fake_generic.py +++ b/test/python/providers/fake_provider/test_fake_generic.py @@ -19,7 +19,7 @@ from qiskit.providers.fake_provider import GenericBackendV2 from qiskit.transpiler import CouplingMap from qiskit.exceptions import QiskitError -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestGenericBackendV2(QiskitTestCase): diff --git a/test/python/providers/test_backend_v2.py b/test/python/providers/test_backend_v2.py index 970224c55dbc..2d582db513f3 100644 --- a/test/python/providers/test_backend_v2.py +++ b/test/python/providers/test_backend_v2.py @@ -21,7 +21,6 @@ from qiskit.circuit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit.compiler import transpile -from qiskit.test.base import QiskitTestCase from qiskit.providers.fake_provider import FakeMumbaiFractionalCX from qiskit.providers.fake_provider.fake_backend_v2 import ( FakeBackendV2, @@ -32,6 +31,7 @@ from qiskit.providers.fake_provider.backends import FakeBogotaV2 from qiskit.quantum_info import Operator from qiskit.pulse import channels +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/providers/test_backendconfiguration.py b/test/python/providers/test_backendconfiguration.py index e418fef2e19a..eb8a62ebfe24 100644 --- a/test/python/providers/test_backendconfiguration.py +++ b/test/python/providers/test_backendconfiguration.py @@ -15,11 +15,10 @@ import collections import copy -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeProvider - from qiskit.pulse.channels import DriveChannel, MeasureChannel, ControlChannel, AcquireChannel from qiskit.providers import BackendConfigurationError +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestBackendConfiguration(QiskitTestCase): diff --git a/test/python/providers/test_backendproperties.py b/test/python/providers/test_backendproperties.py index 3bb15bda1064..b739800b23e2 100644 --- a/test/python/providers/test_backendproperties.py +++ b/test/python/providers/test_backendproperties.py @@ -15,8 +15,8 @@ import copy from qiskit.providers.fake_provider import FakeProvider, FakeOurense -from qiskit.test import QiskitTestCase from qiskit.providers.exceptions import BackendPropertyError +from test import QiskitTestCase # pylint: disable=wrong-import-order class BackendpropertiesTestCase(QiskitTestCase): diff --git a/test/python/providers/test_backendstatus.py b/test/python/providers/test_backendstatus.py index 95f9e6d9aa82..a594405141ae 100644 --- a/test/python/providers/test_backendstatus.py +++ b/test/python/providers/test_backendstatus.py @@ -13,10 +13,9 @@ Test the BackendStatus. """ -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeLondon - from qiskit.providers.models import BackendStatus +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestBackendConfiguration(QiskitTestCase): diff --git a/test/python/providers/test_fake_backends.py b/test/python/providers/test_fake_backends.py index 67f5413fa2fb..fef2e9d6912e 100644 --- a/test/python/providers/test_fake_backends.py +++ b/test/python/providers/test_fake_backends.py @@ -25,7 +25,6 @@ from qiskit.compiler import assemble from qiskit.compiler import transpile from qiskit.exceptions import QiskitError -from qiskit.test.base import QiskitTestCase from qiskit.providers.fake_provider import ( FakeProviderForBackendV2, FakeProvider, @@ -77,6 +76,7 @@ BreakLoopOp, SwitchCaseOp, ) +from test.utils.base import QiskitTestCase # pylint: disable=wrong-import-order FAKE_PROVIDER_FOR_BACKEND_V2 = FakeProviderForBackendV2() FAKE_PROVIDER = FakeProvider() diff --git a/test/python/providers/test_faulty_backend.py b/test/python/providers/test_faulty_backend.py index 6d6f87b39ba4..a5c7e5e5a339 100644 --- a/test/python/providers/test_faulty_backend.py +++ b/test/python/providers/test_faulty_backend.py @@ -12,9 +12,8 @@ """Testing a Faulty Ourense Backend.""" -from qiskit.test import QiskitTestCase from qiskit.providers.backend_compat import convert_to_target - +from test import QiskitTestCase # pylint: disable=wrong-import-order from .faulty_backends import ( FakeOurenseFaultyCX01CX10, FakeOurenseFaultyQ1, diff --git a/test/python/providers/test_options.py b/test/python/providers/test_options.py index bbc2aaf13253..194423fef528 100644 --- a/test/python/providers/test_options.py +++ b/test/python/providers/test_options.py @@ -18,7 +18,7 @@ from qiskit.providers import Options from qiskit.qobj.utils import MeasLevel -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestOptions(QiskitTestCase): diff --git a/test/python/providers/test_pulse_defaults.py b/test/python/providers/test_pulse_defaults.py index a85e1bdaec46..33fe9ecbad65 100644 --- a/test/python/providers/test_pulse_defaults.py +++ b/test/python/providers/test_pulse_defaults.py @@ -17,8 +17,8 @@ import numpy as np -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeOpenPulse2Q +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestPulseDefaults(QiskitTestCase): diff --git a/test/python/pulse/test_block.py b/test/python/pulse/test_block.py index 0ddd645d8bcf..3af2d0b510d1 100644 --- a/test/python/pulse/test_block.py +++ b/test/python/pulse/test_block.py @@ -18,8 +18,8 @@ from qiskit import pulse, circuit from qiskit.pulse import transforms from qiskit.pulse.exceptions import PulseError -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeOpenPulse2Q +from test import QiskitTestCase # pylint: disable=wrong-import-order class BaseTestBlock(QiskitTestCase): diff --git a/test/python/pulse/test_builder.py b/test/python/pulse/test_builder.py index 08e816d3cf51..efb61fb37bd9 100644 --- a/test/python/pulse/test_builder.py +++ b/test/python/pulse/test_builder.py @@ -13,16 +13,15 @@ """Test pulse builder context utilities.""" from math import pi - import numpy as np from qiskit import circuit, compiler, pulse from qiskit.pulse import builder, exceptions, macros from qiskit.pulse.instructions import directives from qiskit.pulse.transforms import target_qobj_transform -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeOpenPulse2Q, FakeWashington from qiskit.pulse import library, instructions +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestBuilder(QiskitTestCase): diff --git a/test/python/pulse/test_builder_v2.py b/test/python/pulse/test_builder_v2.py index 71ef5986f07f..b5601a80f866 100644 --- a/test/python/pulse/test_builder_v2.py +++ b/test/python/pulse/test_builder_v2.py @@ -21,7 +21,7 @@ from qiskit.pulse.transforms import target_qobj_transform from qiskit.providers.fake_provider import FakeMumbaiV2 from qiskit.pulse import instructions -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestBuilderV2(QiskitTestCase): diff --git a/test/python/pulse/test_calibration_entries.py b/test/python/pulse/test_calibration_entries.py index 47d0793fc100..20e6773d2fd2 100644 --- a/test/python/pulse/test_calibration_entries.py +++ b/test/python/pulse/test_calibration_entries.py @@ -32,7 +32,7 @@ from qiskit.pulse.exceptions import PulseError from qiskit.qobj.converters.pulse_instruction import QobjToInstructionConverter from qiskit.qobj.pulse_qobj import PulseLibraryItem, PulseQobjInstruction -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestSchedule(QiskitTestCase): diff --git a/test/python/pulse/test_channels.py b/test/python/pulse/test_channels.py index 2ad0d08fe259..59c4d15bf67b 100644 --- a/test/python/pulse/test_channels.py +++ b/test/python/pulse/test_channels.py @@ -27,7 +27,7 @@ SnapshotChannel, PulseError, ) -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestChannel(QiskitTestCase): diff --git a/test/python/pulse/test_continuous_pulses.py b/test/python/pulse/test_continuous_pulses.py index 9c716d54b563..affe949e7d9d 100644 --- a/test/python/pulse/test_continuous_pulses.py +++ b/test/python/pulse/test_continuous_pulses.py @@ -15,8 +15,8 @@ import numpy as np -from qiskit.test import QiskitTestCase from qiskit.pulse.library import continuous +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestContinuousPulses(QiskitTestCase): diff --git a/test/python/pulse/test_experiment_configurations.py b/test/python/pulse/test_experiment_configurations.py index 85ed4368cfb8..8d6a93b39eac 100644 --- a/test/python/pulse/test_experiment_configurations.py +++ b/test/python/pulse/test_experiment_configurations.py @@ -17,7 +17,7 @@ from qiskit.pulse.channels import DriveChannel, MeasureChannel, AcquireChannel from qiskit.pulse.exceptions import PulseError from qiskit.pulse import LoConfig, LoRange, Kernel, Discriminator -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestLoRange(QiskitTestCase): diff --git a/test/python/pulse/test_instruction_schedule_map.py b/test/python/pulse/test_instruction_schedule_map.py index 8c4fd3cb7784..51b9a9aef038 100644 --- a/test/python/pulse/test_instruction_schedule_map.py +++ b/test/python/pulse/test_instruction_schedule_map.py @@ -33,8 +33,8 @@ from qiskit.pulse.channels import DriveChannel from qiskit.qobj import PulseQobjInstruction from qiskit.qobj.converters import QobjToInstructionConverter -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeOpenPulse2Q, FakeAthens +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestInstructionScheduleMap(QiskitTestCase): diff --git a/test/python/pulse/test_instructions.py b/test/python/pulse/test_instructions.py index 480972ef0fd0..f0bdd165db08 100644 --- a/test/python/pulse/test_instructions.py +++ b/test/python/pulse/test_instructions.py @@ -16,7 +16,7 @@ from qiskit import circuit from qiskit.pulse import channels, configuration, instructions, library, exceptions -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestAcquire(QiskitTestCase): diff --git a/test/python/pulse/test_macros.py b/test/python/pulse/test_macros.py index 99cb873c67e2..71b6bb5dd850 100644 --- a/test/python/pulse/test_macros.py +++ b/test/python/pulse/test_macros.py @@ -25,7 +25,7 @@ from qiskit.pulse import macros from qiskit.pulse.exceptions import PulseError from qiskit.providers.fake_provider import FakeOpenPulse2Q, FakeHanoi, GenericBackendV2 -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestMeasure(QiskitTestCase): diff --git a/test/python/pulse/test_parameter_manager.py b/test/python/pulse/test_parameter_manager.py index 6d251b9192f4..baeb30e47498 100644 --- a/test/python/pulse/test_parameter_manager.py +++ b/test/python/pulse/test_parameter_manager.py @@ -24,7 +24,7 @@ from qiskit.pulse.exceptions import PulseError, UnassignedDurationError from qiskit.pulse.parameter_manager import ParameterGetter, ParameterSetter from qiskit.pulse.transforms import AlignEquispaced, AlignLeft, inline_subroutines -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class ParameterTestBase(QiskitTestCase): diff --git a/test/python/pulse/test_parser.py b/test/python/pulse/test_parser.py index 3a34a1bb6e2b..8fb491b9da74 100644 --- a/test/python/pulse/test_parser.py +++ b/test/python/pulse/test_parser.py @@ -12,9 +12,9 @@ """Parser Test.""" -from qiskit.test import QiskitTestCase from qiskit.pulse.parser import parse_string_expr from qiskit.pulse.exceptions import PulseError +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestInstructionToQobjConverter(QiskitTestCase): diff --git a/test/python/pulse/test_pulse_lib.py b/test/python/pulse/test_pulse_lib.py index 41bb823867af..daf163a2c32b 100644 --- a/test/python/pulse/test_pulse_lib.py +++ b/test/python/pulse/test_pulse_lib.py @@ -37,9 +37,8 @@ Sech, SechDeriv, ) - from qiskit.pulse import functional_pulse, PulseError -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestWaveform(QiskitTestCase): diff --git a/test/python/pulse/test_reference.py b/test/python/pulse/test_reference.py index 0996ecb3be31..e2e0f5a2c307 100644 --- a/test/python/pulse/test_reference.py +++ b/test/python/pulse/test_reference.py @@ -17,7 +17,7 @@ from qiskit import circuit, pulse from qiskit.pulse import builder from qiskit.pulse.transforms import inline_subroutines -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestReference(QiskitTestCase): diff --git a/test/python/pulse/test_samplers.py b/test/python/pulse/test_samplers.py index 29647155c21f..4e6ab46737d6 100644 --- a/test/python/pulse/test_samplers.py +++ b/test/python/pulse/test_samplers.py @@ -15,9 +15,9 @@ import numpy as np -from qiskit.test import QiskitTestCase from qiskit.pulse import library from qiskit.pulse.library import samplers +from test import QiskitTestCase # pylint: disable=wrong-import-order def linear(times: np.ndarray, m: float, b: float = 0.1) -> np.ndarray: diff --git a/test/python/pulse/test_schedule.py b/test/python/pulse/test_schedule.py index 3ed4bde91c56..40d637887ed0 100644 --- a/test/python/pulse/test_schedule.py +++ b/test/python/pulse/test_schedule.py @@ -45,8 +45,8 @@ ) from qiskit.pulse.exceptions import PulseError from qiskit.pulse.schedule import Schedule, _overlaps, _find_insertion_index -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeOpenPulse2Q +from test import QiskitTestCase # pylint: disable=wrong-import-order class BaseTestSchedule(QiskitTestCase): diff --git a/test/python/pulse/test_transforms.py b/test/python/pulse/test_transforms.py index 5cbf4ac9cd4b..5918a6e6993d 100644 --- a/test/python/pulse/test_transforms.py +++ b/test/python/pulse/test_transforms.py @@ -37,8 +37,8 @@ SnapshotChannel, ) from qiskit.pulse.instructions import directives -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeOpenPulse2Q +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestAlignMeasures(QiskitTestCase): diff --git a/test/python/qasm2/test_arxiv_examples.py b/test/python/qasm2/test_arxiv_examples.py index 46d7c1e84663..197b842697e1 100644 --- a/test/python/qasm2/test_arxiv_examples.py +++ b/test/python/qasm2/test_arxiv_examples.py @@ -25,7 +25,7 @@ from qiskit import qasm2 from qiskit.circuit import QuantumCircuit, QuantumRegister, ClassicalRegister, Qubit from qiskit.circuit.library import U1Gate, U3Gate, CU1Gate -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order from . import gate_builder diff --git a/test/python/qasm2/test_circuit_methods.py b/test/python/qasm2/test_circuit_methods.py index 78839de14455..1ba9689ab3ef 100644 --- a/test/python/qasm2/test_circuit_methods.py +++ b/test/python/qasm2/test_circuit_methods.py @@ -18,14 +18,13 @@ from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit.circuit import Gate, Parameter from qiskit.exceptions import QiskitError -from qiskit.test import QiskitTestCase from qiskit.transpiler.passes import UnrollCustomDefinitions, BasisTranslator from qiskit.converters.circuit_to_dag import circuit_to_dag from qiskit.qasm2 import dumps - from qiskit.circuit.library.standard_gates.equivalence_library import ( StandardEquivalenceLibrary as std_eqlib, ) +from test import QiskitTestCase # pylint: disable=wrong-import-order class LoadFromQasmTest(QiskitTestCase): diff --git a/test/python/qasm2/test_export.py b/test/python/qasm2/test_export.py index 04b5f0c92f15..a0a3ade6ce86 100644 --- a/test/python/qasm2/test_export.py +++ b/test/python/qasm2/test_export.py @@ -21,8 +21,8 @@ from math import pi from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, qasm2 -from qiskit.test import QiskitTestCase from qiskit.circuit import Parameter, Qubit, Clbit, Gate, library as lib +from test import QiskitTestCase # pylint: disable=wrong-import-order # Regex pattern to match valid OpenQASM identifiers VALID_QASM2_IDENTIFIER = re.compile("[a-z][a-zA-Z_0-9]*") diff --git a/test/python/qasm2/test_expression.py b/test/python/qasm2/test_expression.py index 9906d1574f9d..98aead7f3b43 100644 --- a/test/python/qasm2/test_expression.py +++ b/test/python/qasm2/test_expression.py @@ -19,7 +19,7 @@ import ddt import qiskit.qasm2 -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt.ddt diff --git a/test/python/qasm2/test_lexer.py b/test/python/qasm2/test_lexer.py index 6d3c4a52d588..238423fa6e7b 100644 --- a/test/python/qasm2/test_lexer.py +++ b/test/python/qasm2/test_lexer.py @@ -15,7 +15,7 @@ import ddt import qiskit.qasm2 -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt.ddt diff --git a/test/python/qasm2/test_parse_errors.py b/test/python/qasm2/test_parse_errors.py index 1963fc64b3b6..0cb8ee7b78d7 100644 --- a/test/python/qasm2/test_parse_errors.py +++ b/test/python/qasm2/test_parse_errors.py @@ -19,9 +19,8 @@ import qiskit.qasm2 from qiskit.circuit import Gate, library as lib -from qiskit.test import QiskitTestCase - from test import combine # pylint: disable=wrong-import-order +from test import QiskitTestCase # pylint: disable=wrong-import-order # We need to use this enum a _bunch_ of times, so let's not give it a long name. diff --git a/test/python/qasm2/test_structure.py b/test/python/qasm2/test_structure.py index 0b9774357a5d..52152807a106 100644 --- a/test/python/qasm2/test_structure.py +++ b/test/python/qasm2/test_structure.py @@ -35,7 +35,7 @@ Qubit, library as lib, ) -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order from . import gate_builder diff --git a/test/python/qasm3/test_export.py b/test/python/qasm3/test_export.py index 3637923af6c0..cece6e20ec10 100644 --- a/test/python/qasm3/test_export.py +++ b/test/python/qasm3/test_export.py @@ -26,10 +26,10 @@ from qiskit.circuit import Parameter, Qubit, Clbit, Instruction, Gate, Delay, Barrier from qiskit.circuit.classical import expr from qiskit.circuit.controlflow import CASE_DEFAULT -from qiskit.test import QiskitTestCase from qiskit.qasm3 import Exporter, dumps, dump, QASM3ExporterError, ExperimentalFeatures from qiskit.qasm3.exporter import QASM3Builder from qiskit.qasm3.printer import BasicPrinter +from test import QiskitTestCase # pylint: disable=wrong-import-order # Tests marked with this decorator should be restored after gate definition with parameters is fixed diff --git a/test/python/qasm3/test_import.py b/test/python/qasm3/test_import.py index dcc0ba3f823e..929a1999f63f 100644 --- a/test/python/qasm3/test_import.py +++ b/test/python/qasm3/test_import.py @@ -23,8 +23,8 @@ from qiskit import qasm3 from qiskit.circuit import QuantumCircuit, QuantumRegister, ClassicalRegister -from qiskit.test import QiskitTestCase from qiskit.utils import optionals +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestQASM3Import(QiskitTestCase): diff --git a/test/python/qobj/test_pulse_converter.py b/test/python/qobj/test_pulse_converter.py index 2bdfeea8708d..cacbde2cd8b5 100644 --- a/test/python/qobj/test_pulse_converter.py +++ b/test/python/qobj/test_pulse_converter.py @@ -47,8 +47,8 @@ QobjToInstructionConverter, LoConfigConverter, ) -from qiskit.test import QiskitTestCase from qiskit.exceptions import QiskitError +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestInstructionToQobjConverter(QiskitTestCase): diff --git a/test/python/qobj/test_qobj.py b/test/python/qobj/test_qobj.py index d66ec50ee6d9..c0b96a1bda5e 100644 --- a/test/python/qobj/test_qobj.py +++ b/test/python/qobj/test_qobj.py @@ -17,7 +17,6 @@ from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit from qiskit.compiler import assemble - from qiskit.qobj import ( QasmQobj, PulseQobj, @@ -34,7 +33,7 @@ GateCalibration, ) -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestQASMQobj(QiskitTestCase): diff --git a/test/python/qobj/test_qobj_identifiers.py b/test/python/qobj/test_qobj_identifiers.py index 0fd695c7e56b..d319aa4611de 100644 --- a/test/python/qobj/test_qobj_identifiers.py +++ b/test/python/qobj/test_qobj_identifiers.py @@ -18,7 +18,7 @@ from qiskit.circuit import ClassicalRegister, QuantumCircuit, QuantumRegister from qiskit.compiler import assemble -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestQobjIdentifiers(QiskitTestCase): diff --git a/test/python/qpy/test_block_load_from_qpy.py b/test/python/qpy/test_block_load_from_qpy.py index 807ccd489c0a..10c1b8eda1ee 100644 --- a/test/python/qpy/test_block_load_from_qpy.py +++ b/test/python/qpy/test_block_load_from_qpy.py @@ -15,7 +15,6 @@ import io import unittest from ddt import ddt, data, unpack - import numpy as np import symengine as sym @@ -38,10 +37,10 @@ ) from qiskit.pulse.instructions import Play, TimeBlockade from qiskit.circuit import Parameter, QuantumCircuit, Gate -from qiskit.test import QiskitTestCase from qiskit.qpy import dump, load from qiskit.utils import optionals as _optional from qiskit.pulse.configuration import Kernel, Discriminator +from test import QiskitTestCase # pylint: disable=wrong-import-order class QpyScheduleTestCase(QiskitTestCase): diff --git a/test/python/qpy/test_circuit_load_from_qpy.py b/test/python/qpy/test_circuit_load_from_qpy.py index f5d4df7e8f01..384ef066d8d8 100644 --- a/test/python/qpy/test_circuit_load_from_qpy.py +++ b/test/python/qpy/test_circuit_load_from_qpy.py @@ -22,10 +22,10 @@ from qiskit.exceptions import QiskitError from qiskit.qpy import dump, load, formats, QPY_COMPATIBILITY_VERSION from qiskit.qpy.common import QPY_VERSION -from qiskit.test import QiskitTestCase from qiskit.transpiler import PassManager, TranspileLayout from qiskit.transpiler import passes from qiskit.compiler import transpile +from test import QiskitTestCase # pylint: disable=wrong-import-order class QpyCircuitTestCase(QiskitTestCase): diff --git a/test/python/quantum_info/operators/symplectic/test_clifford.py b/test/python/quantum_info/operators/symplectic/test_clifford.py index 615f09e6ad21..f23c0155bc6d 100644 --- a/test/python/quantum_info/operators/symplectic/test_clifford.py +++ b/test/python/quantum_info/operators/symplectic/test_clifford.py @@ -14,9 +14,6 @@ """Tests for Clifford class.""" import unittest - -from test import combine - import numpy as np from ddt import ddt @@ -67,7 +64,8 @@ synth_clifford_greedy, ) from qiskit.synthesis.linear import random_invertible_binary_matrix -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order +from test import combine # pylint: disable=wrong-import-order class VGate(Gate): diff --git a/test/python/quantum_info/operators/symplectic/test_pauli.py b/test/python/quantum_info/operators/symplectic/test_pauli.py index a0c6d4d6330d..c6e99d236bbd 100644 --- a/test/python/quantum_info/operators/symplectic/test_pauli.py +++ b/test/python/quantum_info/operators/symplectic/test_pauli.py @@ -18,7 +18,6 @@ import unittest import itertools as it from functools import lru_cache - import numpy as np from ddt import ddt, data, unpack @@ -39,10 +38,10 @@ SwapGate, ) from qiskit.circuit.library.generalized_gates import PauliGate -from qiskit.test import QiskitTestCase - from qiskit.quantum_info.random import random_clifford, random_pauli from qiskit.quantum_info.operators import Pauli, Operator +from test import QiskitTestCase # pylint: disable=wrong-import-order + LABEL_REGEX = re.compile(r"(?P[+-]?1?[ij]?)(?P[IXYZ]*)") PHASE_MAP = {"": 0, "-i": 1, "-": 2, "i": 3} diff --git a/test/python/quantum_info/operators/symplectic/test_pauli_list.py b/test/python/quantum_info/operators/symplectic/test_pauli_list.py index c856112a196f..48f77d440d51 100644 --- a/test/python/quantum_info/operators/symplectic/test_pauli_list.py +++ b/test/python/quantum_info/operators/symplectic/test_pauli_list.py @@ -14,7 +14,6 @@ import itertools import unittest -from test import combine import numpy as np from ddt import ddt @@ -41,7 +40,8 @@ PauliList, ) from qiskit.quantum_info.random import random_clifford, random_pauli_list -from qiskit.test import QiskitTestCase +from test import combine # pylint: disable=wrong-import-order +from test import QiskitTestCase # pylint: disable=wrong-import-order from .test_pauli import pauli_group_labels diff --git a/test/python/quantum_info/operators/symplectic/test_pauli_utils.py b/test/python/quantum_info/operators/symplectic/test_pauli_utils.py index 070d204ac727..b8c4086b70b8 100644 --- a/test/python/quantum_info/operators/symplectic/test_pauli_utils.py +++ b/test/python/quantum_info/operators/symplectic/test_pauli_utils.py @@ -15,8 +15,8 @@ import unittest -from qiskit.test import QiskitTestCase from qiskit.quantum_info import PauliList, pauli_basis +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestPauliBasis(QiskitTestCase): diff --git a/test/python/quantum_info/operators/symplectic/test_sparse_pauli_op.py b/test/python/quantum_info/operators/symplectic/test_sparse_pauli_op.py index c519855faa6f..8fb64bfab62c 100644 --- a/test/python/quantum_info/operators/symplectic/test_sparse_pauli_op.py +++ b/test/python/quantum_info/operators/symplectic/test_sparse_pauli_op.py @@ -14,8 +14,6 @@ import itertools as it import unittest -from test import combine - import numpy as np from ddt import ddt @@ -23,11 +21,12 @@ from qiskit.circuit import ParameterExpression, Parameter, ParameterVector from qiskit.circuit.parametertable import ParameterView from qiskit.quantum_info.operators import Operator, Pauli, PauliList, SparsePauliOp -from qiskit.test import QiskitTestCase from qiskit.circuit.library import EfficientSU2 from qiskit.primitives import BackendEstimator from qiskit.providers.fake_provider import FakeNairobiV2 from qiskit.compiler.transpiler import transpile +from test import QiskitTestCase # pylint: disable=wrong-import-order +from test import combine # pylint: disable=wrong-import-order def pauli_mat(label): diff --git a/test/python/quantum_info/operators/test_measures.py b/test/python/quantum_info/operators/test_measures.py index 32b66419e34f..beb2367093fa 100644 --- a/test/python/quantum_info/operators/test_measures.py +++ b/test/python/quantum_info/operators/test_measures.py @@ -12,7 +12,6 @@ """Tests for operator measures.""" import unittest -from test import combine from ddt import ddt import numpy as np @@ -22,7 +21,8 @@ from qiskit.quantum_info import average_gate_fidelity from qiskit.quantum_info import gate_error from qiskit.quantum_info import diamond_norm -from qiskit.test import QiskitTestCase +from test import combine # pylint: disable=wrong-import-order +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/quantum_info/operators/test_operator.py b/test/python/quantum_info/operators/test_operator.py index 63b74c169020..fc824643a0ba 100644 --- a/test/python/quantum_info/operators/test_operator.py +++ b/test/python/quantum_info/operators/test_operator.py @@ -26,13 +26,13 @@ from qiskit import QiskitError from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit from qiskit.circuit.library import HGate, CHGate, CXGate, QFT -from qiskit.test import QiskitTestCase from qiskit.transpiler.layout import Layout, TranspileLayout from qiskit.quantum_info.operators import Operator, ScalarOp from qiskit.quantum_info.operators.predicates import matrix_equal from qiskit.compiler.transpiler import transpile from qiskit.circuit import Qubit from qiskit.circuit.library import Permutation, PermutationGate +from test import QiskitTestCase # pylint: disable=wrong-import-order logger = logging.getLogger(__name__) diff --git a/test/python/quantum_info/operators/test_random.py b/test/python/quantum_info/operators/test_random.py index 20e8fdf96a29..cb7e85ffabe3 100644 --- a/test/python/quantum_info/operators/test_random.py +++ b/test/python/quantum_info/operators/test_random.py @@ -27,7 +27,7 @@ random_quantum_channel, random_unitary, ) -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/quantum_info/operators/test_scalar_op.py b/test/python/quantum_info/operators/test_scalar_op.py index fa07b286e9bb..21809188022c 100644 --- a/test/python/quantum_info/operators/test_scalar_op.py +++ b/test/python/quantum_info/operators/test_scalar_op.py @@ -13,13 +13,13 @@ """Tests for ScalarOp class.""" import unittest -from test import combine import numpy as np from ddt import ddt from qiskit.quantum_info.operators import Operator, ScalarOp -from qiskit.test import QiskitTestCase +from test import combine # pylint: disable=wrong-import-order +from test import QiskitTestCase # pylint: disable=wrong-import-order class ScalarOpTestCase(QiskitTestCase): diff --git a/test/python/quantum_info/operators/test_utils.py b/test/python/quantum_info/operators/test_utils.py index bedc7919367d..63699074eff2 100644 --- a/test/python/quantum_info/operators/test_utils.py +++ b/test/python/quantum_info/operators/test_utils.py @@ -17,7 +17,7 @@ from ddt import data, ddt, unpack from qiskit.quantum_info import SparsePauliOp, anti_commutator, commutator, double_commutator -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order I = SparsePauliOp("I") X = SparsePauliOp("X") diff --git a/test/python/quantum_info/states/test_densitymatrix.py b/test/python/quantum_info/states/test_densitymatrix.py index 3185758cb469..4f5c728604b5 100644 --- a/test/python/quantum_info/states/test_densitymatrix.py +++ b/test/python/quantum_info/states/test_densitymatrix.py @@ -25,8 +25,9 @@ from qiskit.quantum_info.operators.symplectic import Pauli, SparsePauliOp from qiskit.quantum_info.random import random_density_matrix, random_pauli, random_unitary from qiskit.quantum_info.states import DensityMatrix, Statevector -from qiskit.test import QiskitTestCase from qiskit.utils import optionals +from test import QiskitTestCase # pylint: disable=wrong-import-order + logger = logging.getLogger(__name__) diff --git a/test/python/quantum_info/states/test_measures.py b/test/python/quantum_info/states/test_measures.py index a22e2e427aee..0c1e7ff6189a 100644 --- a/test/python/quantum_info/states/test_measures.py +++ b/test/python/quantum_info/states/test_measures.py @@ -16,7 +16,6 @@ import numpy as np from qiskit import QiskitError -from qiskit.test import QiskitTestCase from qiskit.quantum_info.states import DensityMatrix, Statevector from qiskit.quantum_info import state_fidelity from qiskit.quantum_info import purity @@ -26,6 +25,7 @@ from qiskit.quantum_info import mutual_information from qiskit.quantum_info.states import shannon_entropy from qiskit.quantum_info import negativity +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestStateMeasures(QiskitTestCase): diff --git a/test/python/quantum_info/states/test_random.py b/test/python/quantum_info/states/test_random.py index 9a947678985a..da40440489ce 100644 --- a/test/python/quantum_info/states/test_random.py +++ b/test/python/quantum_info/states/test_random.py @@ -17,10 +17,10 @@ from ddt import ddt import numpy as np -from qiskit.test import QiskitTestCase from qiskit.quantum_info import Statevector, DensityMatrix from qiskit.quantum_info.random import random_statevector from qiskit.quantum_info.random import random_density_matrix +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/quantum_info/states/test_stabilizerstate.py b/test/python/quantum_info/states/test_stabilizerstate.py index c7053e1d109b..be8033607268 100644 --- a/test/python/quantum_info/states/test_stabilizerstate.py +++ b/test/python/quantum_info/states/test_stabilizerstate.py @@ -14,19 +14,19 @@ """Tests for Stabilizerstate quantum state class.""" import unittest -from test import combine import logging from ddt import ddt, data, unpack import numpy as np -from qiskit.test import QiskitTestCase from qiskit import QuantumCircuit from qiskit.quantum_info.random import random_clifford, random_pauli from qiskit.quantum_info.states import StabilizerState, Statevector from qiskit.circuit.library import IGate, XGate, HGate from qiskit.quantum_info.operators import Clifford, Pauli, Operator +from test import combine # pylint: disable=wrong-import-order +from test import QiskitTestCase # pylint: disable=wrong-import-order logger = logging.getLogger(__name__) diff --git a/test/python/quantum_info/states/test_statevector.py b/test/python/quantum_info/states/test_statevector.py index 700d190346de..29d5d42f3783 100644 --- a/test/python/quantum_info/states/test_statevector.py +++ b/test/python/quantum_info/states/test_statevector.py @@ -20,20 +20,19 @@ import numpy as np from numpy.testing import assert_allclose -from qiskit.test import QiskitTestCase from qiskit import QiskitError from qiskit import QuantumRegister, QuantumCircuit from qiskit import transpile from qiskit.circuit.library import HGate, QFT, GlobalPhaseGate from qiskit.providers.basic_provider import BasicSimulator from qiskit.utils import optionals - from qiskit.quantum_info.random import random_unitary, random_statevector, random_pauli from qiskit.quantum_info.states import Statevector from qiskit.quantum_info.operators.operator import Operator from qiskit.quantum_info.operators.symplectic import Pauli, SparsePauliOp from qiskit.quantum_info.operators.predicates import matrix_equal from qiskit.visualization.state_visualization import state_to_latex +from test import QiskitTestCase # pylint: disable=wrong-import-order logger = logging.getLogger(__name__) diff --git a/test/python/quantum_info/states/test_utils.py b/test/python/quantum_info/states/test_utils.py index 1978c052f213..9a9015944e70 100644 --- a/test/python/quantum_info/states/test_utils.py +++ b/test/python/quantum_info/states/test_utils.py @@ -15,9 +15,9 @@ import unittest import numpy as np -from qiskit.test import QiskitTestCase from qiskit.quantum_info.states import Statevector, DensityMatrix from qiskit.quantum_info.states import partial_trace, shannon_entropy, schmidt_decomposition +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestStateUtils(QiskitTestCase): diff --git a/test/python/quantum_info/test_analyzation.py b/test/python/quantum_info/test_analyzation.py index 5da8b818a86f..083bc01532c4 100644 --- a/test/python/quantum_info/test_analyzation.py +++ b/test/python/quantum_info/test_analyzation.py @@ -19,7 +19,7 @@ from qiskit.quantum_info.analysis.average import average_data from qiskit.quantum_info.analysis.make_observable import make_dict_observable from qiskit.quantum_info.analysis import hellinger_fidelity -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestAnalyzation(QiskitTestCase): diff --git a/test/python/quantum_info/test_quaternions.py b/test/python/quantum_info/test_quaternions.py index c639e468313f..48e2ead8b894 100644 --- a/test/python/quantum_info/test_quaternions.py +++ b/test/python/quantum_info/test_quaternions.py @@ -18,8 +18,7 @@ import scipy.linalg as la from qiskit.quantum_info.quaternion import Quaternion - -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestQuaternions(QiskitTestCase): diff --git a/test/python/quantum_info/test_sparse_z2_symmetries.py b/test/python/quantum_info/test_sparse_z2_symmetries.py index 907dbeca0cd7..6b1b1f346b64 100644 --- a/test/python/quantum_info/test_sparse_z2_symmetries.py +++ b/test/python/quantum_info/test_sparse_z2_symmetries.py @@ -14,10 +14,9 @@ import unittest -from qiskit.test import QiskitTestCase - from qiskit.quantum_info import Pauli, PauliList, SparsePauliOp from qiskit.quantum_info.analysis.z2_symmetries import Z2Symmetries +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestSparseZ2Symmetries(QiskitTestCase): diff --git a/test/python/result/test_memory_marginalization.py b/test/python/result/test_memory_marginalization.py index 88385cf8df82..ed3759b7989a 100644 --- a/test/python/result/test_memory_marginalization.py +++ b/test/python/result/test_memory_marginalization.py @@ -14,8 +14,8 @@ import numpy as np -from qiskit.test import QiskitTestCase from qiskit.result import marginal_memory +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestMarginalMemory(QiskitTestCase): diff --git a/test/python/result/test_mitigators.py b/test/python/result/test_mitigators.py index ab482833e2e2..17db5fec8cfa 100644 --- a/test/python/result/test_mitigators.py +++ b/test/python/result/test_mitigators.py @@ -33,8 +33,8 @@ str2diag, ) from qiskit.result.utils import marginal_counts -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeYorktown +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestReadoutMitigation(QiskitTestCase): diff --git a/test/python/result/test_probability.py b/test/python/result/test_probability.py index 8da709847b08..9d152c93d82e 100644 --- a/test/python/result/test_probability.py +++ b/test/python/result/test_probability.py @@ -11,8 +11,9 @@ # that they have been altered from the originals. """Test conversion to probability distribution""" -from qiskit.test import QiskitTestCase + from qiskit.result import ProbDistribution +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestProbDistribution(QiskitTestCase): diff --git a/test/python/result/test_quasi.py b/test/python/result/test_quasi.py index e124c569a81f..13673294a605 100644 --- a/test/python/result/test_quasi.py +++ b/test/python/result/test_quasi.py @@ -15,8 +15,8 @@ import numpy as np -from qiskit.test import QiskitTestCase from qiskit.result import QuasiDistribution, marginal_distribution +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestQuasi(QiskitTestCase): diff --git a/test/python/result/test_result.py b/test/python/result/test_result.py index c914fe38311c..1bbecb6b65e8 100644 --- a/test/python/result/test_result.py +++ b/test/python/result/test_result.py @@ -19,8 +19,8 @@ from qiskit.result import marginal_distribution from qiskit.result import Result from qiskit.qobj import QobjExperimentHeader -from qiskit.test import QiskitTestCase from qiskit.exceptions import QiskitError +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestResultOperations(QiskitTestCase): diff --git a/test/python/result/test_sampled_expval.py b/test/python/result/test_sampled_expval.py index cb68099b310e..85658fc8e6e1 100644 --- a/test/python/result/test_sampled_expval.py +++ b/test/python/result/test_sampled_expval.py @@ -13,10 +13,10 @@ """Tests for qiskit.quantum_info.analysis""" import unittest + from qiskit.result import Counts, QuasiDistribution, ProbDistribution, sampled_expectation_value from qiskit.quantum_info import Pauli, SparsePauliOp -from qiskit.test import QiskitTestCase - +from test import QiskitTestCase # pylint: disable=wrong-import-order PROBS = { "1000": 0.0022, diff --git a/test/python/scheduler/test_basic_scheduler.py b/test/python/scheduler/test_basic_scheduler.py index f26a4fe6c7a8..6f15527eff3a 100644 --- a/test/python/scheduler/test_basic_scheduler.py +++ b/test/python/scheduler/test_basic_scheduler.py @@ -31,9 +31,8 @@ transforms, ) from qiskit.pulse import build, macros, play, InstructionScheduleMap - from qiskit.providers.fake_provider import FakeBackend, FakeOpenPulse2Q, FakeOpenPulse3Q, FakePerth -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestBasicSchedule(QiskitTestCase): diff --git a/test/python/synthesis/aqc/fast_gradient/test_cmp_gradients.py b/test/python/synthesis/aqc/fast_gradient/test_cmp_gradients.py index 3f648d946c7b..782f4d5a30a7 100644 --- a/test/python/synthesis/aqc/fast_gradient/test_cmp_gradients.py +++ b/test/python/synthesis/aqc/fast_gradient/test_cmp_gradients.py @@ -17,11 +17,15 @@ import unittest from typing import Tuple from time import perf_counter -from test.python.synthesis.aqc.fast_gradient.utils_for_testing import rand_circuit, rand_su_mat import numpy as np + from qiskit.synthesis.unitary.aqc.fast_gradient.fast_gradient import FastCNOTUnitObjective from qiskit.synthesis.unitary.aqc.cnot_unit_objective import DefaultCNOTUnitObjective -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order +from test.python.synthesis.aqc.fast_gradient.utils_for_testing import ( # pylint: disable=wrong-import-order + rand_circuit, + rand_su_mat, +) class TestCompareGradientImpls(QiskitTestCase): diff --git a/test/python/synthesis/aqc/fast_gradient/test_layer1q.py b/test/python/synthesis/aqc/fast_gradient/test_layer1q.py index 2173e6d5c792..43b164c42257 100644 --- a/test/python/synthesis/aqc/fast_gradient/test_layer1q.py +++ b/test/python/synthesis/aqc/fast_gradient/test_layer1q.py @@ -16,11 +16,12 @@ import unittest from random import randint -import test.python.synthesis.aqc.fast_gradient.utils_for_testing as tut import numpy as np + import qiskit.synthesis.unitary.aqc.fast_gradient.layer as lr from qiskit.synthesis.unitary.aqc.fast_gradient.pmatrix import PMatrix -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order +import test.python.synthesis.aqc.fast_gradient.utils_for_testing as tut # pylint: disable=wrong-import-order class TestLayer1q(QiskitTestCase): diff --git a/test/python/synthesis/aqc/fast_gradient/test_layer2q.py b/test/python/synthesis/aqc/fast_gradient/test_layer2q.py index f97f53ad7d7c..9de1e13df2d0 100644 --- a/test/python/synthesis/aqc/fast_gradient/test_layer2q.py +++ b/test/python/synthesis/aqc/fast_gradient/test_layer2q.py @@ -16,11 +16,12 @@ import unittest from random import randint -import test.python.synthesis.aqc.fast_gradient.utils_for_testing as tut import numpy as np + import qiskit.synthesis.unitary.aqc.fast_gradient.layer as lr from qiskit.synthesis.unitary.aqc.fast_gradient.pmatrix import PMatrix -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order +import test.python.synthesis.aqc.fast_gradient.utils_for_testing as tut # pylint: disable=wrong-import-order class TestLayer2q(QiskitTestCase): diff --git a/test/python/synthesis/aqc/fast_gradient/test_utils.py b/test/python/synthesis/aqc/fast_gradient/test_utils.py index ea84650791c6..3ea414048ae2 100644 --- a/test/python/synthesis/aqc/fast_gradient/test_utils.py +++ b/test/python/synthesis/aqc/fast_gradient/test_utils.py @@ -16,13 +16,14 @@ import unittest import random -import test.python.synthesis.aqc.fast_gradient.utils_for_testing as tut import numpy as np + import qiskit.synthesis.unitary.aqc.fast_gradient.fast_grad_utils as myu -from qiskit.test import QiskitTestCase from qiskit.synthesis.unitary.aqc.elementary_operations import rx_matrix as _rx from qiskit.synthesis.unitary.aqc.elementary_operations import ry_matrix as _ry from qiskit.synthesis.unitary.aqc.elementary_operations import rz_matrix as _rz +from test import QiskitTestCase # pylint: disable=wrong-import-order +import test.python.synthesis.aqc.fast_gradient.utils_for_testing as tut # pylint: disable=wrong-import-order class TestUtils(QiskitTestCase): diff --git a/test/python/synthesis/aqc/test_aqc.py b/test/python/synthesis/aqc/test_aqc.py index 3d153c492181..901f62336885 100644 --- a/test/python/synthesis/aqc/test_aqc.py +++ b/test/python/synthesis/aqc/test_aqc.py @@ -13,21 +13,22 @@ Tests AQC framework using hardcoded and randomly generated circuits. """ from functools import partial - import unittest -from test.python.synthesis.aqc.sample_data import ORIGINAL_CIRCUIT, INITIAL_THETAS - from ddt import ddt, data import numpy as np from scipy.optimize import minimize from qiskit.quantum_info import Operator -from qiskit.test import QiskitTestCase from qiskit.synthesis.unitary.aqc.aqc import AQC from qiskit.synthesis.unitary.aqc.cnot_structures import make_cnot_network from qiskit.synthesis.unitary.aqc.cnot_unit_circuit import CNOTUnitCircuit from qiskit.synthesis.unitary.aqc.cnot_unit_objective import DefaultCNOTUnitObjective from qiskit.synthesis.unitary.aqc.fast_gradient.fast_gradient import FastCNOTUnitObjective +from test import QiskitTestCase # pylint: disable=wrong-import-order +from test.python.synthesis.aqc.sample_data import ( # pylint: disable=wrong-import-order + ORIGINAL_CIRCUIT, + INITIAL_THETAS, +) @ddt diff --git a/test/python/synthesis/aqc/test_aqc_plugin.py b/test/python/synthesis/aqc/test_aqc_plugin.py index b55e6ffb379b..38b03d107672 100644 --- a/test/python/synthesis/aqc/test_aqc_plugin.py +++ b/test/python/synthesis/aqc/test_aqc_plugin.py @@ -20,10 +20,10 @@ from qiskit import QuantumCircuit from qiskit.converters import dag_to_circuit, circuit_to_dag from qiskit.quantum_info import Operator -from qiskit.test import QiskitTestCase from qiskit.transpiler import PassManager from qiskit.transpiler.passes import UnitarySynthesis from qiskit.transpiler.passes.synthesis import AQCSynthesisPlugin +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestAQCSynthesisPlugin(QiskitTestCase): diff --git a/test/python/synthesis/aqc/test_cnot_networks.py b/test/python/synthesis/aqc/test_cnot_networks.py index f844d1a4b6e5..b5e452166a23 100644 --- a/test/python/synthesis/aqc/test_cnot_networks.py +++ b/test/python/synthesis/aqc/test_cnot_networks.py @@ -12,13 +12,16 @@ """ Tests building up CNOT unit structures. """ -from test.python.synthesis.aqc.sample_data import CARTAN_4, CARTAN_3 import numpy as np from ddt import ddt, data, unpack -from qiskit.test import QiskitTestCase from qiskit.synthesis.unitary.aqc import make_cnot_network +from test import QiskitTestCase # pylint: disable=wrong-import-order +from test.python.synthesis.aqc.sample_data import ( # pylint: disable=wrong-import-order + CARTAN_4, + CARTAN_3, +) @ddt diff --git a/test/python/synthesis/aqc/test_gradient.py b/test/python/synthesis/aqc/test_gradient.py index 584b0f3c7313..c89c83ff02d7 100644 --- a/test/python/synthesis/aqc/test_gradient.py +++ b/test/python/synthesis/aqc/test_gradient.py @@ -14,11 +14,15 @@ """ import unittest -from test.python.synthesis.aqc.sample_data import ORIGINAL_CIRCUIT, INITIAL_THETAS import numpy as np -from qiskit.test import QiskitTestCase + from qiskit.synthesis.unitary.aqc.cnot_structures import make_cnot_network from qiskit.synthesis.unitary.aqc.cnot_unit_objective import DefaultCNOTUnitObjective +from test import QiskitTestCase # pylint: disable=wrong-import-order +from test.python.synthesis.aqc.sample_data import ( # pylint: disable=wrong-import-order + ORIGINAL_CIRCUIT, + INITIAL_THETAS, +) class TestGradientAgainstFiniteDiff(QiskitTestCase): diff --git a/test/python/synthesis/test_clifford_decompose_layers.py b/test/python/synthesis/test_clifford_decompose_layers.py index cf15f11a1f90..19183ce17303 100644 --- a/test/python/synthesis/test_clifford_decompose_layers.py +++ b/test/python/synthesis/test_clifford_decompose_layers.py @@ -14,16 +14,16 @@ """Tests for Clifford synthesis methods.""" import unittest -from test import combine from ddt import ddt import numpy as np -from qiskit.test import QiskitTestCase from qiskit.quantum_info.operators import Clifford from qiskit.quantum_info import random_clifford from qiskit.synthesis.clifford import synth_clifford_layers, synth_clifford_depth_lnn from qiskit.synthesis.linear.linear_circuits_utils import check_lnn_connectivity +from test import combine # pylint: disable=wrong-import-order +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/synthesis/test_cnot_phase_synthesis.py b/test/python/synthesis/test_cnot_phase_synthesis.py index 39ae60bf6bcd..85d3633f2aa2 100644 --- a/test/python/synthesis/test_cnot_phase_synthesis.py +++ b/test/python/synthesis/test_cnot_phase_synthesis.py @@ -13,7 +13,6 @@ """Test cnot circuit and cnot-phase circuit synthesis algorithms""" import unittest - import ddt from qiskit.circuit import QuantumCircuit, QuantumRegister @@ -21,7 +20,7 @@ from qiskit.quantum_info.operators import Operator from qiskit.synthesis.linear import synth_cnot_count_full_pmh from qiskit.synthesis.linear_phase import synth_cnot_phase_aam -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt.ddt diff --git a/test/python/synthesis/test_cx_cz_synthesis.py b/test/python/synthesis/test_cx_cz_synthesis.py index eec3afe1dfff..ef7eeb38b8f6 100644 --- a/test/python/synthesis/test_cx_cz_synthesis.py +++ b/test/python/synthesis/test_cx_cz_synthesis.py @@ -16,19 +16,16 @@ from test import combine import numpy as np from ddt import ddt -from qiskit import QuantumCircuit +from qiskit import QuantumCircuit from qiskit.quantum_info import Clifford - from qiskit.synthesis.linear_phase.cx_cz_depth_lnn import synth_cx_cz_depth_line_my from qiskit.synthesis.linear import ( synth_cnot_depth_line_kms, random_invertible_binary_matrix, ) - from qiskit.synthesis.linear.linear_circuits_utils import check_lnn_connectivity - -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/synthesis/test_cz_synthesis.py b/test/python/synthesis/test_cz_synthesis.py index 6db88da039d5..7284039e56c8 100644 --- a/test/python/synthesis/test_cz_synthesis.py +++ b/test/python/synthesis/test_cz_synthesis.py @@ -13,15 +13,16 @@ """Test CZ circuits synthesis functions.""" import unittest -from test import combine import numpy as np from ddt import ddt + from qiskit import QuantumCircuit from qiskit.circuit.library import Permutation from qiskit.synthesis.linear_phase import synth_cz_depth_line_mr from qiskit.synthesis.linear.linear_circuits_utils import check_lnn_connectivity from qiskit.quantum_info import Clifford -from qiskit.test import QiskitTestCase +from test import combine # pylint: disable=wrong-import-order +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/synthesis/test_linear_synthesis.py b/test/python/synthesis/test_linear_synthesis.py index 0448414e6b70..98a49b6642f7 100644 --- a/test/python/synthesis/test_linear_synthesis.py +++ b/test/python/synthesis/test_linear_synthesis.py @@ -26,7 +26,7 @@ calc_inverse_matrix, ) from qiskit.synthesis.linear.linear_circuits_utils import transpose_cx_circ, optimize_cx_4_options -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/synthesis/test_local_invariance.py b/test/python/synthesis/test_local_invariance.py index badbf04040aa..db36f58a03af 100644 --- a/test/python/synthesis/test_local_invariance.py +++ b/test/python/synthesis/test_local_invariance.py @@ -14,12 +14,12 @@ """Tests for local invariance routines.""" import unittest - from numpy.testing import assert_allclose + from qiskit import QuantumCircuit, QuantumRegister -from qiskit.test import QiskitTestCase from qiskit.synthesis.two_qubit.local_invariance import two_qubit_local_invariants from qiskit.quantum_info import Operator +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestLocalInvariance(QiskitTestCase): diff --git a/test/python/synthesis/test_permutation_synthesis.py b/test/python/synthesis/test_permutation_synthesis.py index 85e4be4d7cb1..7fc6f5e24ab8 100644 --- a/test/python/synthesis/test_permutation_synthesis.py +++ b/test/python/synthesis/test_permutation_synthesis.py @@ -22,7 +22,7 @@ from qiskit.synthesis import synth_permutation_acg from qiskit.synthesis.permutation import synth_permutation_depth_lnn_kms, synth_permutation_basic from qiskit.synthesis.permutation.permutation_utils import _get_ordered_swap -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/synthesis/test_qft_synthesis.py b/test/python/synthesis/test_qft_synthesis.py index 2ea8e6033cb9..d208d8c9fcd2 100644 --- a/test/python/synthesis/test_qft_synthesis.py +++ b/test/python/synthesis/test_qft_synthesis.py @@ -17,12 +17,11 @@ from test import combine from ddt import ddt -from qiskit.test import QiskitTestCase from qiskit.circuit.library import QFT from qiskit.synthesis.qft import synth_qft_line from qiskit.quantum_info import Operator - from qiskit.synthesis.linear.linear_circuits_utils import check_lnn_connectivity +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/synthesis/test_stabilizer_circuit.py b/test/python/synthesis/test_stabilizer_circuit.py index 1e27480a98d0..c2b1b713eaa6 100644 --- a/test/python/synthesis/test_stabilizer_circuit.py +++ b/test/python/synthesis/test_stabilizer_circuit.py @@ -14,19 +14,15 @@ import unittest from collections.abc import Collection - -from test import combine - from ddt import ddt - import numpy as np from qiskit.synthesis import synth_circuit_from_stabilizers from qiskit.exceptions import QiskitError from qiskit.quantum_info import Pauli, StabilizerState, random_clifford from qiskit.quantum_info.operators import Clifford - -from qiskit.test import QiskitTestCase +from test import combine # pylint: disable=wrong-import-order +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/synthesis/test_stabilizer_synthesis.py b/test/python/synthesis/test_stabilizer_synthesis.py index 5e3b8ce61b14..e195c9cf2707 100644 --- a/test/python/synthesis/test_stabilizer_synthesis.py +++ b/test/python/synthesis/test_stabilizer_synthesis.py @@ -14,16 +14,16 @@ import unittest -from test import combine from ddt import ddt import numpy as np -from qiskit.test import QiskitTestCase from qiskit.quantum_info.states import StabilizerState from qiskit.quantum_info import random_clifford from qiskit.synthesis.stabilizer import synth_stabilizer_layers, synth_stabilizer_depth_lnn from qiskit.synthesis.linear.linear_circuits_utils import check_lnn_connectivity +from test import combine # pylint: disable=wrong-import-order +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/synthesis/test_synthesis.py b/test/python/synthesis/test_synthesis.py index 88e90b4bd63a..71bac6df0888 100644 --- a/test/python/synthesis/test_synthesis.py +++ b/test/python/synthesis/test_synthesis.py @@ -17,8 +17,6 @@ import contextlib import logging import math -from test import combine - import numpy as np import scipy import scipy.stats @@ -75,9 +73,9 @@ decompose_two_qubit_product_gate, TwoQubitDecomposeUpToDiagonal, ) - from qiskit.synthesis.unitary import qsd -from qiskit.test import QiskitTestCase +from test import combine # pylint: disable=wrong-import-order +from test import QiskitTestCase # pylint: disable=wrong-import-order def make_oneq_cliffords(): diff --git a/test/python/synthesis/test_weyl.py b/test/python/synthesis/test_weyl.py index 688893fb8994..f0773af205ef 100644 --- a/test/python/synthesis/test_weyl.py +++ b/test/python/synthesis/test_weyl.py @@ -17,13 +17,13 @@ import numpy as np from numpy.testing import assert_allclose -from qiskit.test import QiskitTestCase from qiskit.quantum_info.random import random_unitary from qiskit.synthesis.two_qubit.weyl import weyl_coordinates from qiskit.synthesis.two_qubit.local_invariance import ( two_qubit_local_invariants, local_equivalence, ) +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestWeyl(QiskitTestCase): diff --git a/test/python/test_examples.py b/test/python/test_examples.py index a6bb260846da..fc08ff3abaf7 100644 --- a/test/python/test_examples.py +++ b/test/python/test_examples.py @@ -17,7 +17,7 @@ import sys import unittest -from qiskit.test import QiskitTestCase +from test import QiskitTestCase examples_dir = os.path.abspath( os.path.join( diff --git a/test/python/test_user_config.py b/test/python/test_user_config.py index b122c18b88ff..e3e012134639 100644 --- a/test/python/test_user_config.py +++ b/test/python/test_user_config.py @@ -15,11 +15,11 @@ import os import configparser as cp from uuid import uuid4 - from unittest import mock + from qiskit import exceptions -from qiskit.test import QiskitTestCase from qiskit import user_config +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestUserConfig(QiskitTestCase): diff --git a/test/python/test_util.py b/test/python/test_util.py index 2f0c9db30301..f807f0d4e255 100644 --- a/test/python/test_util.py +++ b/test/python/test_util.py @@ -15,7 +15,7 @@ from unittest import mock from qiskit.utils import multiprocessing -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestUtil(QiskitTestCase): diff --git a/test/python/transpiler/legacy_scheduling/test_instruction_alignments.py b/test/python/transpiler/legacy_scheduling/test_instruction_alignments.py index efd3b86ee393..d15e2f0a6978 100644 --- a/test/python/transpiler/legacy_scheduling/test_instruction_alignments.py +++ b/test/python/transpiler/legacy_scheduling/test_instruction_alignments.py @@ -13,7 +13,6 @@ """Testing legacy instruction alignment pass.""" from qiskit import QuantumCircuit, pulse -from qiskit.test import QiskitTestCase from qiskit.transpiler import InstructionDurations from qiskit.transpiler.exceptions import TranspilerError from qiskit.transpiler.passes import ( @@ -22,6 +21,7 @@ ALAPSchedule, TimeUnitConversion, ) +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestAlignMeasures(QiskitTestCase): diff --git a/test/python/transpiler/legacy_scheduling/test_scheduling_pass.py b/test/python/transpiler/legacy_scheduling/test_scheduling_pass.py index 2f375c46f67b..fea814d1b5c9 100644 --- a/test/python/transpiler/legacy_scheduling/test_scheduling_pass.py +++ b/test/python/transpiler/legacy_scheduling/test_scheduling_pass.py @@ -19,12 +19,12 @@ from qiskit import QuantumCircuit from qiskit.circuit import Delay, Parameter from qiskit.circuit.library.standard_gates import XGate, YGate, CXGate -from qiskit.test import QiskitTestCase from qiskit.transpiler.exceptions import TranspilerError from qiskit.transpiler.instruction_durations import InstructionDurations from qiskit.transpiler.passes import ASAPSchedule, ALAPSchedule, DynamicalDecoupling from qiskit.transpiler.passmanager import PassManager from qiskit.transpiler.target import Target, InstructionProperties +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/transpiler/test_1q.py b/test/python/transpiler/test_1q.py index 3ecf438f8fa0..31975456f346 100644 --- a/test/python/transpiler/test_1q.py +++ b/test/python/transpiler/test_1q.py @@ -11,14 +11,15 @@ # that they have been altered from the originals. """Tests preset pass managers with 1Q backend""" -from test import combine + from ddt import ddt from qiskit import QuantumCircuit from qiskit.compiler import transpile -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import Fake1Q from qiskit.transpiler import TranspilerError +from test import combine # pylint: disable=wrong-import-order +from test import QiskitTestCase # pylint: disable=wrong-import-order def emptycircuit(): diff --git a/test/python/transpiler/test_adjacent_barriers.py b/test/python/transpiler/test_adjacent_barriers.py index e979a6a25bef..c50ab268df79 100644 --- a/test/python/transpiler/test_adjacent_barriers.py +++ b/test/python/transpiler/test_adjacent_barriers.py @@ -14,10 +14,11 @@ import random import unittest + from qiskit.transpiler.passes import MergeAdjacentBarriers from qiskit.converters import circuit_to_dag from qiskit import QuantumRegister, QuantumCircuit -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestMergeAdjacentBarriers(QiskitTestCase): diff --git a/test/python/transpiler/test_apply_layout.py b/test/python/transpiler/test_apply_layout.py index d156db19dc18..e7a9a9df6953 100644 --- a/test/python/transpiler/test_apply_layout.py +++ b/test/python/transpiler/test_apply_layout.py @@ -16,13 +16,13 @@ from qiskit.circuit import QuantumRegister, QuantumCircuit, ClassicalRegister from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase from qiskit.transpiler.layout import Layout from qiskit.transpiler.passes import ApplyLayout, SetLayout from qiskit.transpiler.exceptions import TranspilerError from qiskit.transpiler.preset_passmanagers import common from qiskit.providers.fake_provider import FakeVigoV2 from qiskit.transpiler import PassManager +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestApplyLayout(QiskitTestCase): diff --git a/test/python/transpiler/test_barrier_before_final_measurements.py b/test/python/transpiler/test_barrier_before_final_measurements.py index 4b879e0e290a..eb4f509e5301 100644 --- a/test/python/transpiler/test_barrier_before_final_measurements.py +++ b/test/python/transpiler/test_barrier_before_final_measurements.py @@ -14,10 +14,11 @@ import random import unittest + from qiskit.transpiler.passes import BarrierBeforeFinalMeasurements from qiskit.converters import circuit_to_dag from qiskit.circuit import QuantumRegister, QuantumCircuit, ClassicalRegister, Clbit -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestBarrierBeforeFinalMeasurements(QiskitTestCase): diff --git a/test/python/transpiler/test_basic_swap.py b/test/python/transpiler/test_basic_swap.py index 53bd599651d2..f85b619bffc2 100644 --- a/test/python/transpiler/test_basic_swap.py +++ b/test/python/transpiler/test_basic_swap.py @@ -20,7 +20,7 @@ from qiskit.circuit.library import CXGate from qiskit.converters import circuit_to_dag from qiskit import QuantumRegister, QuantumCircuit -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestBasicSwap(QiskitTestCase): diff --git a/test/python/transpiler/test_basis_translator.py b/test/python/transpiler/test_basis_translator.py index 970704bba701..fa9c0383af31 100644 --- a/test/python/transpiler/test_basis_translator.py +++ b/test/python/transpiler/test_basis_translator.py @@ -19,7 +19,6 @@ from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit from qiskit import transpile -from qiskit.test import QiskitTestCase from qiskit.circuit import Gate, Parameter, EquivalenceLibrary, Qubit, Clbit from qiskit.circuit.library import ( U1Gate, @@ -39,11 +38,10 @@ from qiskit.transpiler.target import Target, InstructionProperties from qiskit.transpiler.exceptions import TranspilerError from qiskit.transpiler.passes.basis import BasisTranslator, UnrollCustomDefinitions - - from qiskit.circuit.library.standard_gates.equivalence_library import ( StandardEquivalenceLibrary as std_eqlib, ) +from test import QiskitTestCase # pylint: disable=wrong-import-order class OneQubitZeroParamGate(Gate): diff --git a/test/python/transpiler/test_calibrationbuilder.py b/test/python/transpiler/test_calibrationbuilder.py index 34c8414fb168..bdaec067142e 100644 --- a/test/python/transpiler/test_calibrationbuilder.py +++ b/test/python/transpiler/test_calibrationbuilder.py @@ -16,8 +16,8 @@ import numpy as np from ddt import data, ddt -from qiskit.converters import circuit_to_dag +from qiskit.converters import circuit_to_dag from qiskit import circuit, schedule, QiskitError, QuantumCircuit from qiskit.circuit import Parameter from qiskit.circuit.library.standard_gates import SXGate, RXGate @@ -38,13 +38,13 @@ from qiskit.pulse import builder from qiskit.pulse.transforms import target_qobj_transform from qiskit.dagcircuit import DAGOpNode -from qiskit.test import QiskitTestCase from qiskit.transpiler import PassManager, Target, InstructionProperties from qiskit.transpiler.passes.calibration.builders import ( RZXCalibrationBuilder, RZXCalibrationBuilderNoEcho, RXCalibrationBuilder, ) +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCalibrationBuilder(QiskitTestCase): diff --git a/test/python/transpiler/test_check_gate_direction.py b/test/python/transpiler/test_check_gate_direction.py index 48131f9705d4..0743f4c04cfc 100644 --- a/test/python/transpiler/test_check_gate_direction.py +++ b/test/python/transpiler/test_check_gate_direction.py @@ -21,7 +21,7 @@ from qiskit.transpiler.passes import CheckGateDirection from qiskit.transpiler import CouplingMap, Target from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt.ddt diff --git a/test/python/transpiler/test_check_map.py b/test/python/transpiler/test_check_map.py index 27802c708a96..2a88b272c74d 100644 --- a/test/python/transpiler/test_check_map.py +++ b/test/python/transpiler/test_check_map.py @@ -19,7 +19,7 @@ from qiskit.transpiler.passes import CheckMap from qiskit.transpiler import CouplingMap, Target from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCheckMapCX(QiskitTestCase): diff --git a/test/python/transpiler/test_clifford_passes.py b/test/python/transpiler/test_clifford_passes.py index 216e2f45365b..206a652299c2 100644 --- a/test/python/transpiler/test_clifford_passes.py +++ b/test/python/transpiler/test_clifford_passes.py @@ -21,11 +21,11 @@ from qiskit.dagcircuit import DAGOpNode from qiskit.transpiler.passes import HighLevelSynthesis from qiskit.transpiler.passes import OptimizeCliffords, CollectCliffords -from qiskit.test import QiskitTestCase from qiskit.quantum_info.operators import Clifford from qiskit.transpiler import PassManager from qiskit.quantum_info import Operator, random_clifford from qiskit.compiler.transpiler import transpile +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCliffordPasses(QiskitTestCase): diff --git a/test/python/transpiler/test_collect_2q_blocks.py b/test/python/transpiler/test_collect_2q_blocks.py index 601f2c0747a8..69efc210a9f6 100644 --- a/test/python/transpiler/test_collect_2q_blocks.py +++ b/test/python/transpiler/test_collect_2q_blocks.py @@ -24,8 +24,8 @@ from qiskit.converters import circuit_to_dag from qiskit.transpiler import PassManager from qiskit.transpiler.passes import Collect2qBlocks -from qiskit.test import QiskitTestCase from qiskit.circuit.library import CXGate, U1Gate, U2Gate, RXXGate, RXGate, RZGate +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/transpiler/test_collect_multiq_blocks.py b/test/python/transpiler/test_collect_multiq_blocks.py index 81e43cecffb9..58589d838e33 100644 --- a/test/python/transpiler/test_collect_multiq_blocks.py +++ b/test/python/transpiler/test_collect_multiq_blocks.py @@ -21,7 +21,7 @@ from qiskit.converters import circuit_to_dag from qiskit.transpiler import PassManager from qiskit.transpiler.passes import CollectMultiQBlocks -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCollect2qBlocks(QiskitTestCase): diff --git a/test/python/transpiler/test_commutation_analysis.py b/test/python/transpiler/test_commutation_analysis.py index 7253bcb81693..fc0f8624acae 100644 --- a/test/python/transpiler/test_commutation_analysis.py +++ b/test/python/transpiler/test_commutation_analysis.py @@ -19,7 +19,7 @@ from qiskit.transpiler import PropertySet from qiskit.transpiler.passes import CommutationAnalysis from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCommutationAnalysis(QiskitTestCase): diff --git a/test/python/transpiler/test_commutative_cancellation.py b/test/python/transpiler/test_commutative_cancellation.py index 31931a7fdb4c..1030b83ae2ac 100644 --- a/test/python/transpiler/test_commutative_cancellation.py +++ b/test/python/transpiler/test_commutative_cancellation.py @@ -14,7 +14,6 @@ import unittest import numpy as np -from qiskit.test import QiskitTestCase from qiskit import QuantumRegister, QuantumCircuit from qiskit.circuit.library import U1Gate, RZGate, PhaseGate, CXGate, SXGate @@ -24,6 +23,7 @@ from qiskit.transpiler import PassManager, PropertySet from qiskit.transpiler.passes import CommutationAnalysis, CommutativeCancellation, FixedPoint, Size from qiskit.quantum_info import Operator +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCommutativeCancellation(QiskitTestCase): diff --git a/test/python/transpiler/test_commutative_inverse_cancellation.py b/test/python/transpiler/test_commutative_inverse_cancellation.py index 220c16595d35..cd800a3bb46f 100644 --- a/test/python/transpiler/test_commutative_inverse_cancellation.py +++ b/test/python/transpiler/test_commutative_inverse_cancellation.py @@ -15,13 +15,13 @@ import unittest import numpy as np from ddt import ddt, data -from qiskit.test import QiskitTestCase from qiskit.circuit import Parameter, QuantumCircuit from qiskit.circuit.library import RZGate, UnitaryGate from qiskit.transpiler import PassManager from qiskit.transpiler.passes import CommutativeInverseCancellation from qiskit.quantum_info import Operator +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/transpiler/test_consolidate_blocks.py b/test/python/transpiler/test_consolidate_blocks.py index 6c3d95b88300..9b34d095b3b1 100644 --- a/test/python/transpiler/test_consolidate_blocks.py +++ b/test/python/transpiler/test_consolidate_blocks.py @@ -23,11 +23,11 @@ from qiskit.transpiler.passes import ConsolidateBlocks from qiskit.quantum_info.operators import Operator from qiskit.quantum_info.operators.measures import process_fidelity -from qiskit.test import QiskitTestCase from qiskit.transpiler import PassManager from qiskit.transpiler import Target from qiskit.transpiler.passes import Collect1qRuns from qiskit.transpiler.passes import Collect2qBlocks +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestConsolidateBlocks(QiskitTestCase): diff --git a/test/python/transpiler/test_containsinstruction.py b/test/python/transpiler/test_containsinstruction.py index 489d5b095b0e..f70182eb6f78 100644 --- a/test/python/transpiler/test_containsinstruction.py +++ b/test/python/transpiler/test_containsinstruction.py @@ -16,7 +16,7 @@ from qiskit.circuit import QuantumCircuit from qiskit.dagcircuit import DAGCircuit from qiskit.transpiler.passes import ContainsInstruction -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestContainsInstructionPass(QiskitTestCase): diff --git a/test/python/transpiler/test_convert_conditions_to_if_ops.py b/test/python/transpiler/test_convert_conditions_to_if_ops.py index 8ddf6f2d1a92..799a71163590 100644 --- a/test/python/transpiler/test_convert_conditions_to_if_ops.py +++ b/test/python/transpiler/test_convert_conditions_to_if_ops.py @@ -13,10 +13,10 @@ # pylint: disable=missing-class-docstring,missing-module-docstring from qiskit.circuit import QuantumCircuit, QuantumRegister, ClassicalRegister, Qubit, Clbit -from qiskit.test import QiskitTestCase -from qiskit.test._canonical import canonicalize_control_flow from qiskit.transpiler import PassManager from qiskit.transpiler.passes import ConvertConditionsToIfOps +from test.utils._canonical import canonicalize_control_flow # pylint: disable=wrong-import-order +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestConvertConditionsToIfOps(QiskitTestCase): diff --git a/test/python/transpiler/test_count_ops_longest_path_pass.py b/test/python/transpiler/test_count_ops_longest_path_pass.py index 2354788d0424..7f38991b51fe 100644 --- a/test/python/transpiler/test_count_ops_longest_path_pass.py +++ b/test/python/transpiler/test_count_ops_longest_path_pass.py @@ -17,7 +17,7 @@ from qiskit import QuantumCircuit, QuantumRegister from qiskit.converters import circuit_to_dag from qiskit.transpiler.passes import CountOpsLongestPath -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCountOpsLongestPathPass(QiskitTestCase): diff --git a/test/python/transpiler/test_count_ops_pass.py b/test/python/transpiler/test_count_ops_pass.py index ed8c9091d63a..e278ef08120e 100644 --- a/test/python/transpiler/test_count_ops_pass.py +++ b/test/python/transpiler/test_count_ops_pass.py @@ -17,7 +17,7 @@ from qiskit import QuantumCircuit, QuantumRegister from qiskit.converters import circuit_to_dag from qiskit.transpiler.passes import CountOps -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCountOpsPass(QiskitTestCase): diff --git a/test/python/transpiler/test_coupling.py b/test/python/transpiler/test_coupling.py index 7e2caf71babf..19c444788fa2 100644 --- a/test/python/transpiler/test_coupling.py +++ b/test/python/transpiler/test_coupling.py @@ -20,8 +20,8 @@ from qiskit.transpiler import CouplingMap from qiskit.transpiler.exceptions import CouplingError from qiskit.providers.fake_provider import FakeRueschlikon -from qiskit.test import QiskitTestCase from qiskit.utils import optionals +from test import QiskitTestCase # pylint: disable=wrong-import-order from ..visualization.visualization import QiskitVisualizationTestCase, path_to_diagram_reference diff --git a/test/python/transpiler/test_csp_layout.py b/test/python/transpiler/test_csp_layout.py index 7ab369d7a6e8..f64308099ef6 100644 --- a/test/python/transpiler/test_csp_layout.py +++ b/test/python/transpiler/test_csp_layout.py @@ -19,9 +19,9 @@ from qiskit.transpiler import CouplingMap from qiskit.transpiler.passes import CSPLayout from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeTenerife, FakeRueschlikon, FakeTokyo, FakeYorktownV2 from qiskit.utils import optionals +from test import QiskitTestCase # pylint: disable=wrong-import-order @unittest.skipUnless(optionals.HAS_CONSTRAINT, "needs python-constraint") diff --git a/test/python/transpiler/test_cx_cancellation.py b/test/python/transpiler/test_cx_cancellation.py index f7837501a68a..0a40953c17bd 100644 --- a/test/python/transpiler/test_cx_cancellation.py +++ b/test/python/transpiler/test_cx_cancellation.py @@ -16,7 +16,7 @@ from qiskit.circuit import Clbit, Qubit from qiskit.transpiler import PassManager from qiskit.transpiler.passes import CXCancellation -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCXCancellation(QiskitTestCase): diff --git a/test/python/transpiler/test_dag_fixed_point_pass.py b/test/python/transpiler/test_dag_fixed_point_pass.py index 728eb9ac4d1c..093136bbfa20 100644 --- a/test/python/transpiler/test_dag_fixed_point_pass.py +++ b/test/python/transpiler/test_dag_fixed_point_pass.py @@ -16,7 +16,7 @@ from qiskit.transpiler.passes import DAGFixedPoint from qiskit import QuantumRegister, QuantumCircuit from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestFixedPointPass(QiskitTestCase): diff --git a/test/python/transpiler/test_dag_longest_path_pass.py b/test/python/transpiler/test_dag_longest_path_pass.py index 36ebb154cd5c..8dc3d9e0ee16 100644 --- a/test/python/transpiler/test_dag_longest_path_pass.py +++ b/test/python/transpiler/test_dag_longest_path_pass.py @@ -16,7 +16,7 @@ from qiskit.transpiler.passes import DAGLongestPath from qiskit import QuantumRegister, QuantumCircuit from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestDAGLongestPathPass(QiskitTestCase): diff --git a/test/python/transpiler/test_decompose.py b/test/python/transpiler/test_decompose.py index 555c03509158..91ebede9fa86 100644 --- a/test/python/transpiler/test_decompose.py +++ b/test/python/transpiler/test_decompose.py @@ -19,7 +19,7 @@ from qiskit.converters import circuit_to_dag from qiskit.circuit.library import HGate, CCXGate, U2Gate from qiskit.quantum_info.operators import Operator -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestDecompose(QiskitTestCase): diff --git a/test/python/transpiler/test_dense_layout.py b/test/python/transpiler/test_dense_layout.py index 669fd485b358..68ca1dfcfa5d 100644 --- a/test/python/transpiler/test_dense_layout.py +++ b/test/python/transpiler/test_dense_layout.py @@ -23,9 +23,9 @@ from qiskit.transpiler import CouplingMap, Target, InstructionProperties, TranspilerError from qiskit.transpiler.passes import DenseLayout from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeTokyo from qiskit.transpiler.passes.layout.dense_layout import _build_error_matrix +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestDenseLayout(QiskitTestCase): diff --git a/test/python/transpiler/test_depth_pass.py b/test/python/transpiler/test_depth_pass.py index 38e7dc687c23..3e1f828893ff 100644 --- a/test/python/transpiler/test_depth_pass.py +++ b/test/python/transpiler/test_depth_pass.py @@ -17,7 +17,7 @@ from qiskit import QuantumCircuit, QuantumRegister from qiskit.converters import circuit_to_dag from qiskit.transpiler.passes import Depth -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestDepthPass(QiskitTestCase): diff --git a/test/python/transpiler/test_dynamical_decoupling.py b/test/python/transpiler/test_dynamical_decoupling.py index e53fb9b0226e..6460847b2e81 100644 --- a/test/python/transpiler/test_dynamical_decoupling.py +++ b/test/python/transpiler/test_dynamical_decoupling.py @@ -30,8 +30,7 @@ from qiskit.transpiler.passmanager import PassManager from qiskit.transpiler.exceptions import TranspilerError from qiskit.transpiler.target import Target, InstructionProperties - -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/transpiler/test_echo_rzx_weyl_decomposition.py b/test/python/transpiler/test_echo_rzx_weyl_decomposition.py index d177652cf481..d011769344fc 100644 --- a/test/python/transpiler/test_echo_rzx_weyl_decomposition.py +++ b/test/python/transpiler/test_echo_rzx_weyl_decomposition.py @@ -17,19 +17,14 @@ import numpy as np from qiskit import QuantumRegister, QuantumCircuit - from qiskit.transpiler.passes.optimization.echo_rzx_weyl_decomposition import ( EchoRZXWeylDecomposition, ) from qiskit.converters import circuit_to_dag, dag_to_circuit -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeParis - import qiskit.quantum_info as qi - -from qiskit.synthesis.two_qubit.two_qubit_decompose import ( - TwoQubitWeylDecomposition, -) +from qiskit.synthesis.two_qubit.two_qubit_decompose import TwoQubitWeylDecomposition +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestEchoRZXWeylDecomposition(QiskitTestCase): diff --git a/test/python/transpiler/test_enlarge_with_ancilla_pass.py b/test/python/transpiler/test_enlarge_with_ancilla_pass.py index c58a1df030ba..387078b7d9db 100644 --- a/test/python/transpiler/test_enlarge_with_ancilla_pass.py +++ b/test/python/transpiler/test_enlarge_with_ancilla_pass.py @@ -18,7 +18,7 @@ from qiskit.transpiler import Layout from qiskit.transpiler.passes import EnlargeWithAncilla from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestEnlargeWithAncilla(QiskitTestCase): diff --git a/test/python/transpiler/test_error.py b/test/python/transpiler/test_error.py index e110eaaa4180..ade1dc627929 100644 --- a/test/python/transpiler/test_error.py +++ b/test/python/transpiler/test_error.py @@ -15,8 +15,8 @@ import unittest from qiskit.transpiler.passes import Error -from qiskit.test import QiskitTestCase from qiskit.transpiler.exceptions import TranspilerError +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestErrorPass(QiskitTestCase): diff --git a/test/python/transpiler/test_filter_op_nodes.py b/test/python/transpiler/test_filter_op_nodes.py index 0084dd35d4c0..c1a847e139bf 100644 --- a/test/python/transpiler/test_filter_op_nodes.py +++ b/test/python/transpiler/test_filter_op_nodes.py @@ -15,7 +15,7 @@ from qiskit import QuantumCircuit from qiskit.transpiler.passes import FilterOpNodes -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestFilterOpNodes(QiskitTestCase): diff --git a/test/python/transpiler/test_fixed_point_pass.py b/test/python/transpiler/test_fixed_point_pass.py index 72d0b29e91b6..0cd69e7e06b4 100644 --- a/test/python/transpiler/test_fixed_point_pass.py +++ b/test/python/transpiler/test_fixed_point_pass.py @@ -13,8 +13,9 @@ """FixedPoint pass testing""" import unittest + from qiskit.transpiler.passes import FixedPoint -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestFixedPointPass(QiskitTestCase): diff --git a/test/python/transpiler/test_full_ancilla_allocation.py b/test/python/transpiler/test_full_ancilla_allocation.py index 680d01bcd05d..73d9708d0ba6 100644 --- a/test/python/transpiler/test_full_ancilla_allocation.py +++ b/test/python/transpiler/test_full_ancilla_allocation.py @@ -19,8 +19,8 @@ from qiskit.transpiler import CouplingMap, Layout, Target from qiskit.circuit.library import CXGate from qiskit.transpiler.passes import FullAncillaAllocation -from qiskit.test import QiskitTestCase from qiskit.transpiler.exceptions import TranspilerError +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestFullAncillaAllocation(QiskitTestCase): diff --git a/test/python/transpiler/test_gate_direction.py b/test/python/transpiler/test_gate_direction.py index 172c74e0c292..1e0f19b1a331 100644 --- a/test/python/transpiler/test_gate_direction.py +++ b/test/python/transpiler/test_gate_direction.py @@ -33,7 +33,7 @@ from qiskit.transpiler import TranspilerError, CouplingMap, Target from qiskit.transpiler.passes import GateDirection from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt.ddt diff --git a/test/python/transpiler/test_gates_in_basis_pass.py b/test/python/transpiler/test_gates_in_basis_pass.py index 4092b312b337..62d6ebd2b54a 100644 --- a/test/python/transpiler/test_gates_in_basis_pass.py +++ b/test/python/transpiler/test_gates_in_basis_pass.py @@ -21,8 +21,8 @@ from qiskit.transpiler.passes import BasisTranslator from qiskit.transpiler.passes import GatesInBasis from qiskit.transpiler.target import Target -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider.fake_backend_v2 import FakeBackend5QV2 +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestGatesInBasisPass(QiskitTestCase): diff --git a/test/python/transpiler/test_generic_pass.py b/test/python/transpiler/test_generic_pass.py index a29374651d99..1458f4ec232d 100644 --- a/test/python/transpiler/test_generic_pass.py +++ b/test/python/transpiler/test_generic_pass.py @@ -13,8 +13,8 @@ """BasePass and generic pass testing""" import unittest.mock -from qiskit.test import QiskitTestCase from ._dummy_passes import DummyAP, DummyTP, PassA_TP_NR_NP, PassD_TP_NR_NP, PassE_AP_NR_NP +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestGenericPass(QiskitTestCase): diff --git a/test/python/transpiler/test_high_level_synthesis.py b/test/python/transpiler/test_high_level_synthesis.py index ea5f5ee7e4d6..beb94658e54c 100644 --- a/test/python/transpiler/test_high_level_synthesis.py +++ b/test/python/transpiler/test_high_level_synthesis.py @@ -16,6 +16,7 @@ import itertools import unittest.mock import numpy as np + from qiskit.circuit import ( QuantumCircuit, QuantumRegister, @@ -40,7 +41,6 @@ ) from qiskit.circuit.library.generalized_gates import LinearFunction from qiskit.quantum_info import Clifford -from qiskit.test import QiskitTestCase from qiskit.transpiler.passes.synthesis.plugin import ( HighLevelSynthesisPlugin, HighLevelSynthesisPluginManager, @@ -62,7 +62,7 @@ from qiskit.circuit.library.standard_gates.equivalence_library import ( StandardEquivalenceLibrary as std_eqlib, ) - +from test import QiskitTestCase # pylint: disable=wrong-import-order # In what follows, we create two simple operations OpA and OpB, that potentially mimic # higher-level objects written by a user. diff --git a/test/python/transpiler/test_hoare_opt.py b/test/python/transpiler/test_hoare_opt.py index a756a58d643d..b3ae3df97678 100644 --- a/test/python/transpiler/test_hoare_opt.py +++ b/test/python/transpiler/test_hoare_opt.py @@ -14,14 +14,15 @@ import unittest from numpy import pi + from qiskit.utils import optionals from qiskit.transpiler.passes import HoareOptimizer from qiskit.converters import circuit_to_dag from qiskit import QuantumCircuit -from qiskit.test import QiskitTestCase from qiskit.circuit.library import XGate, RZGate, CSwapGate, SwapGate from qiskit.dagcircuit import DAGOpNode from qiskit.quantum_info import Statevector +from test import QiskitTestCase # pylint: disable=wrong-import-order @unittest.skipUnless(optionals.HAS_Z3, "z3-solver needs to be installed to run these tests") diff --git a/test/python/transpiler/test_instruction_alignments.py b/test/python/transpiler/test_instruction_alignments.py index 7e2fb6e05003..bd14891bb8c4 100644 --- a/test/python/transpiler/test_instruction_alignments.py +++ b/test/python/transpiler/test_instruction_alignments.py @@ -13,10 +13,10 @@ """Testing instruction alignment pass.""" from qiskit import QuantumCircuit, pulse -from qiskit.test import QiskitTestCase from qiskit.transpiler import PassManager from qiskit.transpiler.exceptions import TranspilerError from qiskit.transpiler.passes import ValidatePulseGates +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestPulseGateValidation(QiskitTestCase): diff --git a/test/python/transpiler/test_instruction_durations.py b/test/python/transpiler/test_instruction_durations.py index 4c5a5959a799..de9e7dbf8edb 100644 --- a/test/python/transpiler/test_instruction_durations.py +++ b/test/python/transpiler/test_instruction_durations.py @@ -18,12 +18,11 @@ from qiskit.providers.fake_provider import FakeParis, FakeTokyo from qiskit.transpiler.exceptions import TranspilerError from qiskit.transpiler.instruction_durations import InstructionDurations - -from qiskit.test.base import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestInstructionDurationsClass(QiskitTestCase): - """Test Test InstructionDurations class.""" + """Test InstructionDurations class.""" def test_empty(self): durations = InstructionDurations() diff --git a/test/python/transpiler/test_inverse_cancellation.py b/test/python/transpiler/test_inverse_cancellation.py index c39b531c1b0f..7c210bd92682 100644 --- a/test/python/transpiler/test_inverse_cancellation.py +++ b/test/python/transpiler/test_inverse_cancellation.py @@ -21,7 +21,6 @@ from qiskit.transpiler.exceptions import TranspilerError from qiskit.transpiler.passes import InverseCancellation from qiskit.transpiler import PassManager -from qiskit.test import QiskitTestCase from qiskit.circuit.library import ( RXGate, HGate, @@ -33,6 +32,7 @@ CZGate, RZGate, ) +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestInverseCancellation(QiskitTestCase): diff --git a/test/python/transpiler/test_kak_over_optimization.py b/test/python/transpiler/test_kak_over_optimization.py index 58f792a348cf..a92982f9bfe5 100644 --- a/test/python/transpiler/test_kak_over_optimization.py +++ b/test/python/transpiler/test_kak_over_optimization.py @@ -14,9 +14,10 @@ import unittest import numpy as np + from qiskit import QuantumCircuit, QuantumRegister, transpile from qiskit.circuit.library import CU1Gate -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestKAKOverOptim(QiskitTestCase): diff --git a/test/python/transpiler/test_layout.py b/test/python/transpiler/test_layout.py index cf034b4d70ea..0847e78d6468 100644 --- a/test/python/transpiler/test_layout.py +++ b/test/python/transpiler/test_layout.py @@ -19,7 +19,7 @@ from qiskit.circuit import QuantumRegister, Qubit from qiskit.transpiler.layout import Layout from qiskit.transpiler.exceptions import LayoutError -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class LayoutTest(QiskitTestCase): diff --git a/test/python/transpiler/test_layout_score.py b/test/python/transpiler/test_layout_score.py index 7d60b24d0062..8d5a574da165 100644 --- a/test/python/transpiler/test_layout_score.py +++ b/test/python/transpiler/test_layout_score.py @@ -20,7 +20,7 @@ from qiskit.transpiler import CouplingMap, Layout from qiskit.converters import circuit_to_dag from qiskit.transpiler.target import Target -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestLayoutScoreError(QiskitTestCase): diff --git a/test/python/transpiler/test_layout_transformation.py b/test/python/transpiler/test_layout_transformation.py index 7438192f53e2..267a08dbb4d1 100644 --- a/test/python/transpiler/test_layout_transformation.py +++ b/test/python/transpiler/test_layout_transformation.py @@ -16,10 +16,10 @@ from qiskit import QuantumRegister, QuantumCircuit from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase from qiskit.transpiler import CouplingMap, Layout, Target from qiskit.circuit.library import CXGate from qiskit.transpiler.passes import LayoutTransformation +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestLayoutTransformation(QiskitTestCase): diff --git a/test/python/transpiler/test_linear_functions_passes.py b/test/python/transpiler/test_linear_functions_passes.py index 17eccd769486..e91d2942bbd4 100644 --- a/test/python/transpiler/test_linear_functions_passes.py +++ b/test/python/transpiler/test_linear_functions_passes.py @@ -13,8 +13,6 @@ """Test transpiler passes that deal with linear functions.""" import unittest -from test import combine - from ddt import ddt from qiskit.circuit import QuantumCircuit, Qubit, Clbit @@ -24,11 +22,12 @@ HighLevelSynthesis, LinearFunctionsToPermutations, ) -from qiskit.test import QiskitTestCase from qiskit.circuit.library.generalized_gates import LinearFunction from qiskit.circuit.library import RealAmplitudes from qiskit.transpiler import PassManager from qiskit.quantum_info import Operator +from test import QiskitTestCase # pylint: disable=wrong-import-order +from test import combine # pylint: disable=wrong-import-order @ddt diff --git a/test/python/transpiler/test_lookahead_swap.py b/test/python/transpiler/test_lookahead_swap.py index 70e8ae111daa..890b9b0bb51d 100644 --- a/test/python/transpiler/test_lookahead_swap.py +++ b/test/python/transpiler/test_lookahead_swap.py @@ -14,14 +14,15 @@ import unittest from numpy import pi + from qiskit.dagcircuit import DAGCircuit from qiskit.transpiler.passes import LookaheadSwap from qiskit.transpiler import CouplingMap, Target from qiskit.converters import circuit_to_dag from qiskit.circuit.library import CXGate from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeMelbourne +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestLookaheadSwap(QiskitTestCase): diff --git a/test/python/transpiler/test_mappers.py b/test/python/transpiler/test_mappers.py index 510ba30af635..dc4767b19517 100644 --- a/test/python/transpiler/test_mappers.py +++ b/test/python/transpiler/test_mappers.py @@ -79,8 +79,7 @@ def test_a_common_test(self): from qiskit.transpiler.passes import BasicSwap, LookaheadSwap, StochasticSwap, SabreSwap from qiskit.transpiler.passes import SetLayout from qiskit.transpiler import CouplingMap, Layout - -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class CommonUtilitiesMixin: diff --git a/test/python/transpiler/test_minimum_point.py b/test/python/transpiler/test_minimum_point.py index 0213427982af..1ac4a9ce9fa3 100644 --- a/test/python/transpiler/test_minimum_point.py +++ b/test/python/transpiler/test_minimum_point.py @@ -16,7 +16,7 @@ from qiskit.transpiler.passes import MinimumPoint from qiskit.dagcircuit import DAGCircuit -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestMinimumPointtPass(QiskitTestCase): diff --git a/test/python/transpiler/test_naming_transpiled_circuits.py b/test/python/transpiler/test_naming_transpiled_circuits.py index 6385e9fca180..9150e44ca180 100644 --- a/test/python/transpiler/test_naming_transpiled_circuits.py +++ b/test/python/transpiler/test_naming_transpiled_circuits.py @@ -13,15 +13,16 @@ """Testing naming functionality of transpiled circuits""" import unittest + from qiskit.circuit import QuantumCircuit from qiskit.compiler import transpile from qiskit.providers.basic_provider import BasicSimulator from qiskit.transpiler.exceptions import TranspilerError -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestNamingTranspiledCircuits(QiskitTestCase): - """Testing the naming fuctionality for transpiled circuits.""" + """Testing the naming functionality for transpiled circuits.""" def setUp(self): super().setUp() diff --git a/test/python/transpiler/test_normalize_rx_angle.py b/test/python/transpiler/test_normalize_rx_angle.py index b3669b841afe..be653f64a99a 100644 --- a/test/python/transpiler/test_normalize_rx_angle.py +++ b/test/python/transpiler/test_normalize_rx_angle.py @@ -17,14 +17,13 @@ from ddt import ddt, named_data from qiskit import QuantumCircuit - from qiskit.transpiler.passes.optimization.normalize_rx_angle import ( NormalizeRXAngle, ) -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeBelemV2 from qiskit.transpiler import Target from qiskit.circuit.library.standard_gates import SXGate +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/transpiler/test_optimize_1q_commutation.py b/test/python/transpiler/test_optimize_1q_commutation.py index a15f3aab53b6..a82799b4e31f 100644 --- a/test/python/transpiler/test_optimize_1q_commutation.py +++ b/test/python/transpiler/test_optimize_1q_commutation.py @@ -26,7 +26,7 @@ ) from qiskit.circuit.library import SXGate, PhaseGate from qiskit.transpiler import Target -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt.ddt diff --git a/test/python/transpiler/test_optimize_1q_decomposition.py b/test/python/transpiler/test_optimize_1q_decomposition.py index 72dbae0d3115..f395fc8a1d94 100644 --- a/test/python/transpiler/test_optimize_1q_decomposition.py +++ b/test/python/transpiler/test_optimize_1q_decomposition.py @@ -37,7 +37,7 @@ from qiskit.transpiler.passes import BasisTranslator from qiskit.circuit.equivalence_library import SessionEquivalenceLibrary as sel from qiskit.quantum_info import Operator -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order θ = Parameter("θ") diff --git a/test/python/transpiler/test_optimize_1q_gates.py b/test/python/transpiler/test_optimize_1q_gates.py index 86714159e53e..9253130bedbf 100644 --- a/test/python/transpiler/test_optimize_1q_gates.py +++ b/test/python/transpiler/test_optimize_1q_gates.py @@ -19,11 +19,11 @@ from qiskit.transpiler import PassManager from qiskit.transpiler.passes import Optimize1qGates, BasisTranslator from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase from qiskit.circuit import Parameter from qiskit.circuit.library import U1Gate, U2Gate, U3Gate, UGate, PhaseGate from qiskit.transpiler.exceptions import TranspilerError from qiskit.transpiler.target import Target +from test import QiskitTestCase # pylint: disable=wrong-import-order from qiskit.circuit.library.standard_gates.equivalence_library import ( StandardEquivalenceLibrary as std_eqlib, diff --git a/test/python/transpiler/test_optimize_annotated.py b/test/python/transpiler/test_optimize_annotated.py index 2c80849e513f..6a506516d199 100644 --- a/test/python/transpiler/test_optimize_annotated.py +++ b/test/python/transpiler/test_optimize_annotated.py @@ -21,7 +21,7 @@ PowerModifier, ) from qiskit.transpiler.passes import OptimizeAnnotated -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestOptimizeSwapBeforeMeasure(QiskitTestCase): diff --git a/test/python/transpiler/test_optimize_swap_before_measure.py b/test/python/transpiler/test_optimize_swap_before_measure.py index 258796e56929..6d7c06f410a7 100644 --- a/test/python/transpiler/test_optimize_swap_before_measure.py +++ b/test/python/transpiler/test_optimize_swap_before_measure.py @@ -19,7 +19,7 @@ from qiskit.transpiler import PassManager from qiskit.transpiler.passes import OptimizeSwapBeforeMeasure, DAGFixedPoint from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestOptimizeSwapBeforeMeasure(QiskitTestCase): diff --git a/test/python/transpiler/test_parameterizedgate_translator.py b/test/python/transpiler/test_parameterizedgate_translator.py index 28fa9f140548..94ea3f8a287f 100644 --- a/test/python/transpiler/test_parameterizedgate_translator.py +++ b/test/python/transpiler/test_parameterizedgate_translator.py @@ -14,12 +14,12 @@ import unittest -from qiskit.test import QiskitTestCase from qiskit.circuit import ParameterVector, Parameter, Gate, QuantumCircuit from qiskit.circuit.library import TwoLocal from qiskit.exceptions import QiskitError from qiskit.transpiler.passes import TranslateParameterizedGates from qiskit.providers.fake_provider import FakeAthensV2 +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestTranslateParameterized(QiskitTestCase): diff --git a/test/python/transpiler/test_pass_call.py b/test/python/transpiler/test_pass_call.py index a33481c26169..a8478f67330f 100644 --- a/test/python/transpiler/test_pass_call.py +++ b/test/python/transpiler/test_pass_call.py @@ -13,9 +13,9 @@ """Test calling passes (passmanager-less)""" from qiskit import QuantumRegister, QuantumCircuit -from qiskit.test import QiskitTestCase from qiskit.transpiler import PropertySet from ._dummy_passes import PassD_TP_NR_NP, PassE_AP_NR_NP, PassN_AP_NR_NP +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestPassCall(QiskitTestCase): diff --git a/test/python/transpiler/test_pass_scheduler.py b/test/python/transpiler/test_pass_scheduler.py index 263db4f64914..6d6026d6148e 100644 --- a/test/python/transpiler/test_pass_scheduler.py +++ b/test/python/transpiler/test_pass_scheduler.py @@ -19,8 +19,8 @@ from qiskit import QuantumRegister, QuantumCircuit from qiskit.transpiler import PassManager, TranspilerError -from qiskit.passmanager.flow_controllers import DoWhileController, ConditionalController -from qiskit.test import QiskitTestCase +from qiskit.passmanager import DoWhileController, ConditionalController +from test import QiskitTestCase # pylint: disable=wrong-import-order from ._dummy_passes import ( PassA_TP_NR_NP, PassB_TP_RA_PA, diff --git a/test/python/transpiler/test_passmanager.py b/test/python/transpiler/test_passmanager.py index 151f478016f3..ce4d28bf314e 100644 --- a/test/python/transpiler/test_passmanager.py +++ b/test/python/transpiler/test_passmanager.py @@ -29,12 +29,10 @@ from qiskit.transpiler import PassManager, PropertySet, TransformationPass from qiskit.transpiler.passes import CommutativeCancellation from qiskit.transpiler.passes import Optimize1qGates, BasisTranslator -from qiskit.test import QiskitTestCase - - from qiskit.circuit.library.standard_gates.equivalence_library import ( StandardEquivalenceLibrary as std_eqlib, ) +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestPassManager(QiskitTestCase): diff --git a/test/python/transpiler/test_passmanager_config.py b/test/python/transpiler/test_passmanager_config.py index ea51572cf4de..5fa511a20d8f 100644 --- a/test/python/transpiler/test_passmanager_config.py +++ b/test/python/transpiler/test_passmanager_config.py @@ -14,10 +14,10 @@ from qiskit import QuantumRegister from qiskit.providers.backend import Backend -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeMelbourne, FakeArmonk, FakeHanoi, FakeHanoiV2 from qiskit.transpiler.coupling import CouplingMap from qiskit.transpiler.passmanager_config import PassManagerConfig +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestPassManagerConfig(QiskitTestCase): diff --git a/test/python/transpiler/test_passmanager_run.py b/test/python/transpiler/test_passmanager_run.py index ac3a2df18ee9..c90302530098 100644 --- a/test/python/transpiler/test_passmanager_run.py +++ b/test/python/transpiler/test_passmanager_run.py @@ -15,10 +15,10 @@ from qiskit import QuantumRegister, QuantumCircuit from qiskit.circuit.library import CXGate from qiskit.transpiler.preset_passmanagers import level_1_pass_manager -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeMelbourne from qiskit.transpiler import Layout, PassManager from qiskit.transpiler.passmanager_config import PassManagerConfig +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestPassManagerRun(QiskitTestCase): diff --git a/test/python/transpiler/test_preset_passmanagers.py b/test/python/transpiler/test_preset_passmanagers.py index dbfef944c1ea..51e12b60cc3a 100644 --- a/test/python/transpiler/test_preset_passmanagers.py +++ b/test/python/transpiler/test_preset_passmanagers.py @@ -29,7 +29,6 @@ PadDynamicalDecoupling, RemoveResetInZeroState, ) -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import ( FakeBelem, FakeTenerife, @@ -47,6 +46,7 @@ from qiskit.transpiler.preset_passmanagers import level0, level1, level2, level3 from qiskit.transpiler.passes import Collect2qBlocks, GatesInBasis from qiskit.transpiler.preset_passmanagers.builtin_plugins import OptimizationPassManager +from test import QiskitTestCase # pylint: disable=wrong-import-order def mock_get_passmanager_stage( diff --git a/test/python/transpiler/test_property_set.py b/test/python/transpiler/test_property_set.py index 3339924ee649..97b8446c7ea7 100644 --- a/test/python/transpiler/test_property_set.py +++ b/test/python/transpiler/test_property_set.py @@ -13,8 +13,9 @@ """Transpiler PropertySet testing""" import unittest + from qiskit.transpiler import PropertySet -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestPropertySet(QiskitTestCase): diff --git a/test/python/transpiler/test_pulse_gate_pass.py b/test/python/transpiler/test_pulse_gate_pass.py index b5f8c03c4711..d793f422150d 100644 --- a/test/python/transpiler/test_pulse_gate_pass.py +++ b/test/python/transpiler/test_pulse_gate_pass.py @@ -17,7 +17,7 @@ from qiskit import pulse, circuit, transpile from qiskit.providers.fake_provider import FakeAthens, FakeAthensV2 from qiskit.quantum_info.random import random_unitary -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt.ddt diff --git a/test/python/transpiler/test_remove_barriers.py b/test/python/transpiler/test_remove_barriers.py index 95efc9f79eb6..fd08dc6ad3e0 100644 --- a/test/python/transpiler/test_remove_barriers.py +++ b/test/python/transpiler/test_remove_barriers.py @@ -16,7 +16,7 @@ from qiskit.transpiler.passes import RemoveBarriers from qiskit.converters import circuit_to_dag from qiskit import QuantumCircuit -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestMergeAdjacentBarriers(QiskitTestCase): diff --git a/test/python/transpiler/test_remove_diagonal_gates_before_measure.py b/test/python/transpiler/test_remove_diagonal_gates_before_measure.py index b68eca204bba..499bc86d9cf2 100644 --- a/test/python/transpiler/test_remove_diagonal_gates_before_measure.py +++ b/test/python/transpiler/test_remove_diagonal_gates_before_measure.py @@ -21,7 +21,7 @@ from qiskit.transpiler import PassManager from qiskit.transpiler.passes import RemoveDiagonalGatesBeforeMeasure, DAGFixedPoint from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TesRemoveDiagonalGatesBeforeMeasure(QiskitTestCase): diff --git a/test/python/transpiler/test_remove_final_measurements.py b/test/python/transpiler/test_remove_final_measurements.py index eabd3c068ac0..4bc0e107109b 100644 --- a/test/python/transpiler/test_remove_final_measurements.py +++ b/test/python/transpiler/test_remove_final_measurements.py @@ -18,7 +18,7 @@ from qiskit.circuit.classicalregister import Clbit from qiskit.transpiler.passes import RemoveFinalMeasurements from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestRemoveFinalMeasurements(QiskitTestCase): diff --git a/test/python/transpiler/test_remove_reset_in_zero_state.py b/test/python/transpiler/test_remove_reset_in_zero_state.py index ebcd2087c0ec..2c29225dd889 100644 --- a/test/python/transpiler/test_remove_reset_in_zero_state.py +++ b/test/python/transpiler/test_remove_reset_in_zero_state.py @@ -19,7 +19,7 @@ from qiskit.transpiler import PassManager from qiskit.transpiler.passes import RemoveResetInZeroState, DAGFixedPoint from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestRemoveResetInZeroState(QiskitTestCase): diff --git a/test/python/transpiler/test_reset_after_measure_simplification.py b/test/python/transpiler/test_reset_after_measure_simplification.py index 64afd8d74838..38f602443c06 100644 --- a/test/python/transpiler/test_reset_after_measure_simplification.py +++ b/test/python/transpiler/test_reset_after_measure_simplification.py @@ -15,7 +15,7 @@ from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit.circuit.classicalregister import Clbit from qiskit.transpiler.passes.optimization import ResetAfterMeasureSimplification -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestResetAfterMeasureSimplificationt(QiskitTestCase): diff --git a/test/python/transpiler/test_resource_estimation_pass.py b/test/python/transpiler/test_resource_estimation_pass.py index 66eb18043684..1b805cc7a8bd 100644 --- a/test/python/transpiler/test_resource_estimation_pass.py +++ b/test/python/transpiler/test_resource_estimation_pass.py @@ -17,7 +17,7 @@ from qiskit import QuantumRegister, QuantumCircuit from qiskit.transpiler import PassManager from qiskit.transpiler.passes import ResourceEstimation -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestResourceEstimationPass(QiskitTestCase): diff --git a/test/python/transpiler/test_sabre_layout.py b/test/python/transpiler/test_sabre_layout.py index ac0db40a8541..eca7ed109136 100644 --- a/test/python/transpiler/test_sabre_layout.py +++ b/test/python/transpiler/test_sabre_layout.py @@ -22,13 +22,13 @@ from qiskit.transpiler.passes import SabreLayout, DenseLayout from qiskit.transpiler.exceptions import TranspilerError from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase from qiskit.compiler.transpiler import transpile from qiskit.providers.fake_provider import FakeAlmaden, FakeAlmadenV2 from qiskit.providers.fake_provider import FakeKolkata from qiskit.providers.fake_provider import FakeMontreal from qiskit.transpiler.passes.layout.sabre_pre_layout import SabrePreLayout from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestSabreLayout(QiskitTestCase): diff --git a/test/python/transpiler/test_sabre_pre_layout.py b/test/python/transpiler/test_sabre_pre_layout.py index 4041cb50b654..47bfd13f9ab8 100644 --- a/test/python/transpiler/test_sabre_pre_layout.py +++ b/test/python/transpiler/test_sabre_pre_layout.py @@ -16,7 +16,7 @@ from qiskit.transpiler import TranspilerError, CouplingMap, PassManager from qiskit.transpiler.passes.layout.sabre_pre_layout import SabrePreLayout from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestSabrePreLayout(QiskitTestCase): diff --git a/test/python/transpiler/test_sabre_swap.py b/test/python/transpiler/test_sabre_swap.py index 5fbee24dc778..5c648956c9cd 100644 --- a/test/python/transpiler/test_sabre_swap.py +++ b/test/python/transpiler/test_sabre_swap.py @@ -28,9 +28,9 @@ from qiskit.transpiler.passes import SabreSwap, TrivialLayout, CheckMap from qiskit.transpiler import CouplingMap, Layout, PassManager, Target, TranspilerError from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit -from qiskit.test import QiskitTestCase -from qiskit.test._canonical import canonicalize_control_flow from qiskit.utils import optionals +from test.utils._canonical import canonicalize_control_flow # pylint: disable=wrong-import-order +from test import QiskitTestCase # pylint: disable=wrong-import-order def looping_circuit(uphill_swaps=1, additional_local_minimum_gates=0): diff --git a/test/python/transpiler/test_scheduling_padding_pass.py b/test/python/transpiler/test_scheduling_padding_pass.py index c981f98649b6..f2f4f6a24bc6 100644 --- a/test/python/transpiler/test_scheduling_padding_pass.py +++ b/test/python/transpiler/test_scheduling_padding_pass.py @@ -19,7 +19,6 @@ from qiskit.circuit import Measure from qiskit.circuit.library import CXGate, HGate from qiskit.pulse import Schedule, Play, Constant, DriveChannel -from qiskit.test import QiskitTestCase from qiskit.transpiler.instruction_durations import InstructionDurations from qiskit.transpiler.passes import ( ASAPScheduleAnalysis, @@ -30,6 +29,7 @@ from qiskit.transpiler.passmanager import PassManager from qiskit.transpiler.exceptions import TranspilerError from qiskit.transpiler.target import Target, InstructionProperties +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/transpiler/test_setlayout.py b/test/python/transpiler/test_setlayout.py index 6ae99b853148..252ccaef9f4f 100644 --- a/test/python/transpiler/test_setlayout.py +++ b/test/python/transpiler/test_setlayout.py @@ -17,8 +17,8 @@ from qiskit import QuantumRegister, QuantumCircuit, ClassicalRegister from qiskit.transpiler import CouplingMap, Layout from qiskit.transpiler.passes import SetLayout, ApplyLayout, FullAncillaAllocation -from qiskit.test import QiskitTestCase from qiskit.transpiler import PassManager, TranspilerError, InvalidLayoutError +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestSetLayout(QiskitTestCase): diff --git a/test/python/transpiler/test_size_pass.py b/test/python/transpiler/test_size_pass.py index eb059ba30baf..9261235c3112 100644 --- a/test/python/transpiler/test_size_pass.py +++ b/test/python/transpiler/test_size_pass.py @@ -17,7 +17,7 @@ from qiskit import QuantumCircuit, QuantumRegister from qiskit.converters import circuit_to_dag from qiskit.transpiler.passes import Size -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestSizePass(QiskitTestCase): diff --git a/test/python/transpiler/test_solovay_kitaev.py b/test/python/transpiler/test_solovay_kitaev.py index 5ce5d85c5b93..e15a080f6f03 100644 --- a/test/python/transpiler/test_solovay_kitaev.py +++ b/test/python/transpiler/test_solovay_kitaev.py @@ -19,8 +19,6 @@ from ddt import ddt, data -from qiskit.test import QiskitTestCase - from qiskit import transpile from qiskit.circuit import QuantumCircuit from qiskit.circuit.library import TGate, TdgGate, HGate, SGate, SdgGate, IGate, QFT @@ -35,6 +33,7 @@ from qiskit.transpiler.exceptions import TranspilerError from qiskit.transpiler.passes import UnitarySynthesis, Collect1qRuns, ConsolidateBlocks from qiskit.transpiler.passes.synthesis import SolovayKitaev, SolovayKitaevSynthesis +from test import QiskitTestCase # pylint: disable=wrong-import-order def _trace_distance(circuit1, circuit2): diff --git a/test/python/transpiler/test_stage_plugin.py b/test/python/transpiler/test_stage_plugin.py index 2316e9b4c2b3..1b58f5c1d5ba 100644 --- a/test/python/transpiler/test_stage_plugin.py +++ b/test/python/transpiler/test_stage_plugin.py @@ -14,13 +14,10 @@ Tests for the staged transpiler plugins. """ -from test import combine - import ddt from qiskit.circuit.quantumcircuit import QuantumCircuit from qiskit.compiler.transpiler import transpile -from qiskit.test import QiskitTestCase from qiskit.transpiler import PassManager, PassManagerConfig, CouplingMap from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager from qiskit.transpiler.preset_passmanagers.builtin_plugins import BasicSwapPassManager @@ -31,6 +28,8 @@ ) from qiskit.transpiler.exceptions import TranspilerError from qiskit.providers.basic_provider import BasicSimulator +from test import combine # pylint: disable=wrong-import-order +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestStagePassManagerPlugin(QiskitTestCase): diff --git a/test/python/transpiler/test_staged_passmanager.py b/test/python/transpiler/test_staged_passmanager.py index 00d95747b1c2..1bdf58044c5a 100644 --- a/test/python/transpiler/test_staged_passmanager.py +++ b/test/python/transpiler/test_staged_passmanager.py @@ -13,6 +13,7 @@ # pylint: disable=missing-function-docstring,missing-class-docstring """Test the staged passmanager logic""" + from unittest.mock import patch from ddt import data, ddt @@ -20,11 +21,10 @@ from qiskit.transpiler import PassManager, StagedPassManager from qiskit.transpiler.exceptions import TranspilerError from qiskit.transpiler.passes import Optimize1qGates, Depth, BasicSwap, BasisTranslator -from qiskit.test import QiskitTestCase - from qiskit.circuit.library.standard_gates.equivalence_library import ( StandardEquivalenceLibrary as std_eqlib, ) +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/transpiler/test_stochastic_swap.py b/test/python/transpiler/test_stochastic_swap.py index 6ef3c01f2924..4a80ad1c6635 100644 --- a/test/python/transpiler/test_stochastic_swap.py +++ b/test/python/transpiler/test_stochastic_swap.py @@ -22,14 +22,14 @@ from qiskit.transpiler.exceptions import TranspilerError from qiskit.converters import circuit_to_dag, dag_to_circuit from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit -from qiskit.test import QiskitTestCase -from qiskit.test._canonical import canonicalize_control_flow from qiskit.transpiler.passes.utils import CheckMap from qiskit.circuit.random import random_circuit from qiskit.providers.fake_provider import FakeMumbai, FakeMumbaiV2 from qiskit.compiler.transpiler import transpile from qiskit.circuit import ControlFlowOp, Clbit, CASE_DEFAULT from qiskit.circuit.classical import expr +from test import QiskitTestCase # pylint: disable=wrong-import-order +from test.utils._canonical import canonicalize_control_flow # pylint: disable=wrong-import-order @ddt diff --git a/test/python/transpiler/test_swap_strategy.py b/test/python/transpiler/test_swap_strategy.py index 1b32f11a661c..6541fbb5f1a0 100644 --- a/test/python/transpiler/test_swap_strategy.py +++ b/test/python/transpiler/test_swap_strategy.py @@ -17,10 +17,9 @@ import numpy as np from qiskit import QiskitError -from qiskit.test import QiskitTestCase from qiskit.transpiler import CouplingMap - from qiskit.transpiler.passes.routing.commuting_2q_gate_routing import SwapStrategy +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/transpiler/test_swap_strategy_router.py b/test/python/transpiler/test_swap_strategy_router.py index 67f746d66724..e35256ec44ca 100644 --- a/test/python/transpiler/test_swap_strategy_router.py +++ b/test/python/transpiler/test_swap_strategy_router.py @@ -16,7 +16,6 @@ from qiskit.circuit import QuantumCircuit, Qubit, QuantumRegister from qiskit.transpiler import PassManager, CouplingMap, Layout, TranspilerError - from qiskit.circuit.library import PauliEvolutionGate from qiskit.circuit.library.n_local import QAOAAnsatz from qiskit.converters import circuit_to_dag @@ -28,9 +27,6 @@ from qiskit.transpiler.passes import SetLayout from qiskit.transpiler.passes import CXCancellation from qiskit.transpiler.passes import Decompose - -from qiskit.test import QiskitTestCase - from qiskit.transpiler.passes.routing.commuting_2q_gate_routing.commuting_2q_block import ( Commuting2qBlock, ) @@ -39,6 +35,7 @@ FindCommutingPauliEvolutions, Commuting2qGateRouter, ) +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/transpiler/test_target.py b/test/python/transpiler/test_target.py index e6eb57042ea7..0b3a13de0461 100644 --- a/test/python/transpiler/test_target.py +++ b/test/python/transpiler/test_target.py @@ -42,7 +42,6 @@ from qiskit.transpiler.exceptions import TranspilerError from qiskit.transpiler import Target from qiskit.transpiler import InstructionProperties -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import ( FakeBackendV2, FakeMumbaiFractionalCX, @@ -50,6 +49,7 @@ FakeNairobi, FakeGeneva, ) +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestTarget(QiskitTestCase): diff --git a/test/python/transpiler/test_template_matching.py b/test/python/transpiler/test_template_matching.py index 9e461305397f..23d56017194c 100644 --- a/test/python/transpiler/test_template_matching.py +++ b/test/python/transpiler/test_template_matching.py @@ -14,7 +14,7 @@ """Test the TemplateOptimization pass.""" import unittest -from test.python.quantum_info.operators.symplectic.test_clifford import random_clifford_circuit + import numpy as np from qiskit import QuantumRegister, QuantumCircuit from qiskit.circuit import Parameter @@ -34,8 +34,11 @@ from qiskit.transpiler import PassManager from qiskit.transpiler.passes import TemplateOptimization from qiskit.transpiler.passes.calibration.rzx_templates import rzx_templates -from qiskit.test import QiskitTestCase from qiskit.transpiler.exceptions import TranspilerError +from test.python.quantum_info.operators.symplectic.test_clifford import ( # pylint: disable=wrong-import-order + random_clifford_circuit, +) +from test import QiskitTestCase # pylint: disable=wrong-import-order def _ry_to_rz_template_pass(parameter: Parameter = None, extra_costs=None): diff --git a/test/python/transpiler/test_tensor_factor_pass.py b/test/python/transpiler/test_tensor_factor_pass.py index a1f3651f5b7c..b7aeafe2ecbb 100644 --- a/test/python/transpiler/test_tensor_factor_pass.py +++ b/test/python/transpiler/test_tensor_factor_pass.py @@ -17,7 +17,7 @@ from qiskit import QuantumCircuit, QuantumRegister from qiskit.converters import circuit_to_dag from qiskit.transpiler.passes import NumTensorFactors -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestNumTensorsFactorPass(QiskitTestCase): diff --git a/test/python/transpiler/test_token_swapper.py b/test/python/transpiler/test_token_swapper.py index 24225f4a359e..9ded634eba75 100644 --- a/test/python/transpiler/test_token_swapper.py +++ b/test/python/transpiler/test_token_swapper.py @@ -30,10 +30,11 @@ import rustworkx as rx from numpy import random + from qiskit.transpiler.passes.routing.algorithms import ApproximateTokenSwapper from qiskit.transpiler.passes.routing.algorithms import util -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestGeneral(QiskitTestCase): diff --git a/test/python/transpiler/test_transpile_layout.py b/test/python/transpiler/test_transpile_layout.py index 0ece5126f374..01e06b57fee4 100644 --- a/test/python/transpiler/test_transpile_layout.py +++ b/test/python/transpiler/test_transpile_layout.py @@ -18,7 +18,7 @@ from qiskit.transpiler.layout import Layout, TranspileLayout from qiskit.transpiler.coupling import CouplingMap from qiskit.compiler import transpile -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TranspileLayoutTest(QiskitTestCase): diff --git a/test/python/transpiler/test_trivial_layout.py b/test/python/transpiler/test_trivial_layout.py index 89c3acf1db48..65bad88b2135 100644 --- a/test/python/transpiler/test_trivial_layout.py +++ b/test/python/transpiler/test_trivial_layout.py @@ -21,8 +21,8 @@ from qiskit.circuit.library import CXGate from qiskit.transpiler import TranspilerError from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeTenerife, FakeRueschlikon +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestTrivialLayout(QiskitTestCase): diff --git a/test/python/transpiler/test_unitary_synthesis.py b/test/python/transpiler/test_unitary_synthesis.py index 93302ca78fd1..f2502664f2f8 100644 --- a/test/python/transpiler/test_unitary_synthesis.py +++ b/test/python/transpiler/test_unitary_synthesis.py @@ -16,14 +16,11 @@ Tests for the default UnitarySynthesis transpiler pass. """ -from test import combine import unittest import numpy as np - from ddt import ddt, data from qiskit import transpile -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeVigo, FakeMumbaiFractionalCX, FakeBelemV2 from qiskit.providers.fake_provider.fake_backend_v2 import FakeBackendV2, FakeBackend5QV2 from qiskit.circuit import QuantumCircuit, QuantumRegister, ClassicalRegister @@ -64,6 +61,8 @@ from qiskit.circuit import Measure from qiskit.circuit.controlflow import IfElseOp from qiskit.circuit import Parameter, Gate +from test import combine # pylint: disable=wrong-import-order +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/transpiler/test_unitary_synthesis_plugin.py b/test/python/transpiler/test_unitary_synthesis_plugin.py index 4aae26987319..ceca591ce087 100644 --- a/test/python/transpiler/test_unitary_synthesis_plugin.py +++ b/test/python/transpiler/test_unitary_synthesis_plugin.py @@ -23,7 +23,6 @@ from qiskit.circuit import QuantumCircuit from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase from qiskit.transpiler import PassManager from qiskit.transpiler.passes import UnitarySynthesis from qiskit.transpiler.passes.synthesis.plugin import ( @@ -32,6 +31,7 @@ unitary_synthesis_plugin_names, ) from qiskit.transpiler.passes.synthesis.unitary_synthesis import DefaultUnitarySynthesis +from test import QiskitTestCase # pylint: disable=wrong-import-order class _MockExtensionManager: diff --git a/test/python/transpiler/test_unroll_3q_or_more.py b/test/python/transpiler/test_unroll_3q_or_more.py index 744620d64fbe..27927bbbd4ad 100644 --- a/test/python/transpiler/test_unroll_3q_or_more.py +++ b/test/python/transpiler/test_unroll_3q_or_more.py @@ -11,6 +11,7 @@ # that they have been altered from the originals. """Test the Unroll3qOrMore pass""" + import numpy as np from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit @@ -20,8 +21,8 @@ from qiskit.converters import circuit_to_dag, dag_to_circuit from qiskit.quantum_info.operators import Operator from qiskit.quantum_info.random import random_unitary -from qiskit.test import QiskitTestCase from qiskit.transpiler import Target +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestUnroll3qOrMore(QiskitTestCase): diff --git a/test/python/transpiler/test_unroll_custom_definitions.py b/test/python/transpiler/test_unroll_custom_definitions.py index bad9c9a53047..cfed023795d7 100644 --- a/test/python/transpiler/test_unroll_custom_definitions.py +++ b/test/python/transpiler/test_unroll_custom_definitions.py @@ -14,13 +14,13 @@ from qiskit.transpiler.passes.basis import UnrollCustomDefinitions -from qiskit.test import QiskitTestCase from qiskit.circuit import EquivalenceLibrary, Gate, Qubit, Clbit, Parameter from qiskit.circuit import QuantumCircuit, QuantumRegister from qiskit.converters import circuit_to_dag from qiskit.exceptions import QiskitError from qiskit.transpiler import Target from qiskit.circuit.library import CXGate, U3Gate +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestGate(Gate): diff --git a/test/python/transpiler/test_unroll_forloops.py b/test/python/transpiler/test_unroll_forloops.py index ffff53761a72..cbf8f70ef767 100644 --- a/test/python/transpiler/test_unroll_forloops.py +++ b/test/python/transpiler/test_unroll_forloops.py @@ -16,8 +16,8 @@ from qiskit.circuit import QuantumCircuit, Parameter, QuantumRegister, ClassicalRegister from qiskit.transpiler import PassManager -from qiskit.test import QiskitTestCase from qiskit.transpiler.passes.utils.unroll_forloops import UnrollForLoops +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestUnrollForLoops(QiskitTestCase): diff --git a/test/python/transpiler/test_vf2_layout.py b/test/python/transpiler/test_vf2_layout.py index b1eb02a489d9..9487a00ad86f 100644 --- a/test/python/transpiler/test_vf2_layout.py +++ b/test/python/transpiler/test_vf2_layout.py @@ -27,7 +27,6 @@ from qiskit.transpiler.passes.layout.vf2_layout import VF2Layout, VF2LayoutStopReason from qiskit._accelerate.error_map import ErrorMap from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import ( FakeTenerife, FakeVigoV2, @@ -41,6 +40,7 @@ from qiskit.transpiler import PassManager, AnalysisPass from qiskit.transpiler.target import InstructionProperties from qiskit.transpiler.preset_passmanagers.common import generate_embed_passmanager +from test import QiskitTestCase # pylint: disable=wrong-import-order class LayoutTestCase(QiskitTestCase): diff --git a/test/python/transpiler/test_vf2_post_layout.py b/test/python/transpiler/test_vf2_post_layout.py index da0dbb274c2b..1fb5021a446b 100644 --- a/test/python/transpiler/test_vf2_post_layout.py +++ b/test/python/transpiler/test_vf2_post_layout.py @@ -20,11 +20,11 @@ from qiskit.transpiler import CouplingMap, Layout, TranspilerError from qiskit.transpiler.passes.layout.vf2_post_layout import VF2PostLayout, VF2PostLayoutStopReason from qiskit.converters import circuit_to_dag -from qiskit.test import QiskitTestCase from qiskit.providers.fake_provider import FakeLima, FakeYorktown, FakeLimaV2, FakeYorktownV2 from qiskit.circuit import Qubit from qiskit.compiler.transpiler import transpile from qiskit.transpiler.target import Target, InstructionProperties +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestVF2PostLayout(QiskitTestCase): diff --git a/test/python/transpiler/test_width_pass.py b/test/python/transpiler/test_width_pass.py index 10dccb17cbc7..4e04f062e72e 100644 --- a/test/python/transpiler/test_width_pass.py +++ b/test/python/transpiler/test_width_pass.py @@ -17,7 +17,7 @@ from qiskit import QuantumCircuit, QuantumRegister from qiskit.converters import circuit_to_dag from qiskit.transpiler.passes import Width -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestWidthPass(QiskitTestCase): diff --git a/test/python/utils/test_classtools.py b/test/python/utils/test_classtools.py index b373675ea569..fd8f3934ac91 100644 --- a/test/python/utils/test_classtools.py +++ b/test/python/utils/test_classtools.py @@ -27,7 +27,7 @@ import sys from qiskit.utils import wrap_method -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order def call_first_argument_with(*args, **kwargs): diff --git a/test/python/utils/test_deprecation.py b/test/python/utils/test_deprecation.py index 56024d2e2e3a..5d3b82e75aa2 100644 --- a/test/python/utils/test_deprecation.py +++ b/test/python/utils/test_deprecation.py @@ -16,7 +16,6 @@ from textwrap import dedent -from qiskit.test import QiskitTestCase from qiskit.utils.deprecation import ( add_deprecation_to_docstring, deprecate_arg, @@ -24,6 +23,7 @@ deprecate_func, deprecate_function, ) +from test import QiskitTestCase # pylint: disable=wrong-import-order @deprecate_func( diff --git a/test/python/utils/test_lazy_loaders.py b/test/python/utils/test_lazy_loaders.py index 7a8c16eda2fe..bd63d7ff04ac 100644 --- a/test/python/utils/test_lazy_loaders.py +++ b/test/python/utils/test_lazy_loaders.py @@ -19,12 +19,11 @@ import sys import warnings from unittest import mock - import ddt from qiskit.exceptions import MissingOptionalLibraryError, OptionalDependencyImportWarning -from qiskit.test import QiskitTestCase from qiskit.utils import LazyImportTester, LazySubprocessTester +from test import QiskitTestCase # pylint: disable=wrong-import-order def available_importer(**kwargs): diff --git a/test/python/utils/test_parallel.py b/test/python/utils/test_parallel.py index 1194150ce4d7..13a4e9b11c2a 100644 --- a/test/python/utils/test_parallel.py +++ b/test/python/utils/test_parallel.py @@ -19,7 +19,7 @@ from qiskit.utils.parallel import get_platform_parallel_default, parallel_map from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit from qiskit.pulse import Schedule -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order def _parfunc(x): diff --git a/test/python/utils/test_units.py b/test/python/utils/test_units.py index b2d88c0424b9..f887fdd18919 100644 --- a/test/python/utils/test_units.py +++ b/test/python/utils/test_units.py @@ -14,8 +14,8 @@ from ddt import ddt, data -from qiskit.test import QiskitTestCase from qiskit.utils import apply_prefix, detach_prefix +from test import QiskitTestCase # pylint: disable=wrong-import-order @ddt diff --git a/test/python/visualization/pulse_v2/test_core.py b/test/python/visualization/pulse_v2/test_core.py index e9b4abfb1959..5855bbafae4a 100644 --- a/test/python/visualization/pulse_v2/test_core.py +++ b/test/python/visualization/pulse_v2/test_core.py @@ -16,9 +16,9 @@ import numpy as np from qiskit import pulse -from qiskit.test import QiskitTestCase from qiskit.visualization.exceptions import VisualizationError from qiskit.visualization.pulse_v2 import core, stylesheet, device_info, drawings, types, layouts +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestChart(QiskitTestCase): diff --git a/test/python/visualization/pulse_v2/test_drawings.py b/test/python/visualization/pulse_v2/test_drawings.py index 414e119c1975..0e07decdd4b3 100644 --- a/test/python/visualization/pulse_v2/test_drawings.py +++ b/test/python/visualization/pulse_v2/test_drawings.py @@ -13,8 +13,8 @@ """Tests for core modules of pulse drawer.""" from qiskit import pulse -from qiskit.test import QiskitTestCase from qiskit.visualization.pulse_v2 import drawings, types +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestDrawingObjects(QiskitTestCase): diff --git a/test/python/visualization/pulse_v2/test_events.py b/test/python/visualization/pulse_v2/test_events.py index 47a7573e2182..fbef9d3de807 100644 --- a/test/python/visualization/pulse_v2/test_events.py +++ b/test/python/visualization/pulse_v2/test_events.py @@ -13,8 +13,8 @@ """Tests for core modules of pulse drawer.""" from qiskit import pulse, circuit -from qiskit.test import QiskitTestCase from qiskit.visualization.pulse_v2 import events +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestChannelEvents(QiskitTestCase): diff --git a/test/python/visualization/pulse_v2/test_generators.py b/test/python/visualization/pulse_v2/test_generators.py index 35f1ad16c6dc..c5f5e8da98ac 100644 --- a/test/python/visualization/pulse_v2/test_generators.py +++ b/test/python/visualization/pulse_v2/test_generators.py @@ -17,9 +17,9 @@ import numpy as np from qiskit import pulse, circuit -from qiskit.test import QiskitTestCase from qiskit.visualization.pulse_v2 import drawings, types, stylesheet, device_info from qiskit.visualization.pulse_v2.generators import barrier, chart, frame, snapshot, waveform +from test import QiskitTestCase # pylint: disable=wrong-import-order def create_instruction(inst, phase, freq, t0, dt, is_opaque=False): diff --git a/test/python/visualization/pulse_v2/test_layouts.py b/test/python/visualization/pulse_v2/test_layouts.py index ed5f0eb4b894..d6a868956fa3 100644 --- a/test/python/visualization/pulse_v2/test_layouts.py +++ b/test/python/visualization/pulse_v2/test_layouts.py @@ -13,8 +13,8 @@ """Tests for core modules of pulse drawer.""" from qiskit import pulse -from qiskit.test import QiskitTestCase from qiskit.visualization.pulse_v2 import layouts, device_info +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestChannelArrangement(QiskitTestCase): diff --git a/test/python/visualization/test_circuit_drawer.py b/test/python/visualization/test_circuit_drawer.py index 9f2bd51d7f23..36d80be4fb39 100644 --- a/test/python/visualization/test_circuit_drawer.py +++ b/test/python/visualization/test_circuit_drawer.py @@ -14,14 +14,14 @@ import unittest import os -from unittest.mock import patch +from unittest.mock import patch from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister -from qiskit.test import QiskitTestCase from qiskit.utils import optionals from qiskit import visualization from qiskit.visualization.circuit import text from qiskit.visualization.exceptions import VisualizationError +from test import QiskitTestCase # pylint: disable=wrong-import-order if optionals.HAS_MATPLOTLIB: from matplotlib import figure diff --git a/test/python/visualization/test_circuit_text_drawer.py b/test/python/visualization/test_circuit_text_drawer.py index dcd4ca0c5581..7271048f589d 100644 --- a/test/python/visualization/test_circuit_text_drawer.py +++ b/test/python/visualization/test_circuit_text_drawer.py @@ -32,7 +32,6 @@ from qiskit.quantum_info import random_clifford from qiskit.quantum_info.operators import SuperOp from qiskit.quantum_info.random import random_unitary -from qiskit.test import QiskitTestCase from qiskit.transpiler.layout import Layout, TranspileLayout from qiskit.visualization.circuit.circuit_visualization import _text_circuit_drawer from qiskit.visualization import circuit_drawer @@ -62,6 +61,8 @@ ) from qiskit.transpiler.passes import ApplyLayout from qiskit.utils.optionals import HAS_TWEEDLEDUM +from test import QiskitTestCase # pylint: disable=wrong-import-order + from .visualization import path_to_diagram_reference, QiskitVisualizationTestCase if HAS_TWEEDLEDUM: diff --git a/test/python/visualization/test_state_plot_tools.py b/test/python/visualization/test_state_plot_tools.py index 028835980415..a555dcaa2149 100644 --- a/test/python/visualization/test_state_plot_tools.py +++ b/test/python/visualization/test_state_plot_tools.py @@ -17,7 +17,7 @@ from qiskit.quantum_info import Statevector from qiskit.visualization.state_visualization import _paulivec_data -from qiskit.test import QiskitTestCase +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestStatePlotTools(QiskitTestCase): diff --git a/test/python/visualization/test_utils.py b/test/python/visualization/test_utils.py index b4f2f5a8e2a2..1dca43b6beb2 100644 --- a/test/python/visualization/test_utils.py +++ b/test/python/visualization/test_utils.py @@ -19,8 +19,8 @@ from qiskit.circuit import Qubit, Clbit from qiskit.visualization.circuit import _utils from qiskit.visualization import array_to_latex -from qiskit.test import QiskitTestCase from qiskit.utils import optionals +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestVisualizationUtils(QiskitTestCase): diff --git a/test/python/visualization/timeline/test_core.py b/test/python/visualization/timeline/test_core.py index 447618acf0eb..16a5457e8d42 100644 --- a/test/python/visualization/timeline/test_core.py +++ b/test/python/visualization/timeline/test_core.py @@ -13,8 +13,8 @@ """Tests for core modules of timeline drawer.""" from qiskit import QuantumCircuit, transpile -from qiskit.test import QiskitTestCase from qiskit.visualization.timeline import core, stylesheet, generators, layouts +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestCanvas(QiskitTestCase): diff --git a/test/python/visualization/timeline/test_drawings.py b/test/python/visualization/timeline/test_drawings.py index fb74a694a148..d3b11e13d2b1 100644 --- a/test/python/visualization/timeline/test_drawings.py +++ b/test/python/visualization/timeline/test_drawings.py @@ -15,8 +15,8 @@ import numpy as np import qiskit -from qiskit.test import QiskitTestCase from qiskit.visualization.timeline import drawings, types +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestDrawingObjects(QiskitTestCase): diff --git a/test/python/visualization/timeline/test_generators.py b/test/python/visualization/timeline/test_generators.py index 83443b27b9eb..66afe3556b3d 100644 --- a/test/python/visualization/timeline/test_generators.py +++ b/test/python/visualization/timeline/test_generators.py @@ -15,9 +15,9 @@ """Tests for generator of timeline drawer.""" import qiskit -from qiskit.test import QiskitTestCase from qiskit.visualization.timeline import generators, types, stylesheet from qiskit.circuit import library, Delay +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestGates(QiskitTestCase): diff --git a/test/python/visualization/timeline/test_layouts.py b/test/python/visualization/timeline/test_layouts.py index eb49619eb357..06089254b316 100644 --- a/test/python/visualization/timeline/test_layouts.py +++ b/test/python/visualization/timeline/test_layouts.py @@ -13,8 +13,8 @@ """Tests for layouts of timeline drawer.""" import qiskit -from qiskit.test import QiskitTestCase from qiskit.visualization.timeline import layouts +from test import QiskitTestCase # pylint: disable=wrong-import-order class TestBitArrange(QiskitTestCase): diff --git a/test/python/visualization/visualization.py b/test/python/visualization/visualization.py index 16ab6cee61ed..bea3cbae78fc 100644 --- a/test/python/visualization/visualization.py +++ b/test/python/visualization/visualization.py @@ -20,8 +20,8 @@ from filecmp import cmp as cmpfile from shutil import copyfile -from qiskit.test import QiskitTestCase from qiskit.utils import optionals as _optionals +from test import QiskitTestCase # pylint: disable=wrong-import-order if _optionals.HAS_MATPLOTLIB: import matplotlib diff --git a/test/randomized/test_transpiler_equivalence.py b/test/randomized/test_transpiler_equivalence.py index 320ffb2f09af..d700845e1c26 100644 --- a/test/randomized/test_transpiler_equivalence.py +++ b/test/randomized/test_transpiler_equivalence.py @@ -48,12 +48,13 @@ """ import os +from test.utils.base import dicts_almost_equal + from math import pi from hypothesis import assume, settings, HealthCheck from hypothesis.stateful import multiple, rule, precondition, invariant from hypothesis.stateful import Bundle, RuleBasedStateMachine - import hypothesis.strategies as st from qiskit import transpile, qasm2 @@ -89,7 +90,6 @@ FakeToronto, FakeValencia, ) -from qiskit.test.base import dicts_almost_equal # pylint: disable=wildcard-import,unused-wildcard-import from qiskit.circuit.library.standard_gates import * diff --git a/qiskit/test/__init__.py b/test/utils/__init__.py similarity index 94% rename from qiskit/test/__init__.py rename to test/utils/__init__.py index 80213dc7d733..12f06556c198 100644 --- a/qiskit/test/__init__.py +++ b/test/utils/__init__.py @@ -12,5 +12,4 @@ """Functionality and helpers for testing Qiskit.""" -from .base import QiskitTestCase from .decorators import slow_test diff --git a/qiskit/test/_canonical.py b/test/utils/_canonical.py similarity index 100% rename from qiskit/test/_canonical.py rename to test/utils/_canonical.py diff --git a/qiskit/test/base.py b/test/utils/base.py similarity index 99% rename from qiskit/test/base.py rename to test/utils/base.py index 953d02b853f5..1b8be97641a8 100644 --- a/qiskit/test/base.py +++ b/test/utils/base.py @@ -323,8 +323,5 @@ def valid_comparison(value): return "" -# Maintain naming backwards compatibility for downstream packages. -BasicQiskitTestCase = QiskitTestCase - if _optionals.HAS_TESTTOOLS and _optionals.HAS_FIXTURES: QiskitTestCase = FullQiskitTestCase diff --git a/qiskit/test/decorators.py b/test/utils/decorators.py similarity index 100% rename from qiskit/test/decorators.py rename to test/utils/decorators.py diff --git a/test/utils/providers/__init__.py b/test/utils/providers/__init__.py new file mode 100644 index 000000000000..46829845c9db --- /dev/null +++ b/test/utils/providers/__init__.py @@ -0,0 +1,15 @@ +# This code is part of Qiskit. +# +# (C) Copyright IBM 2017, 2023. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +"""Module containing one qubit unitary synthesis methods.""" + +from .one_qubit_decompose import OneQubitEulerDecomposer diff --git a/test/visual/mpl/circuit/test_circuit_matplotlib_drawer.py b/test/visual/mpl/circuit/test_circuit_matplotlib_drawer.py index f060f2aa8904..1e0816213315 100644 --- a/test/visual/mpl/circuit/test_circuit_matplotlib_drawer.py +++ b/test/visual/mpl/circuit/test_circuit_matplotlib_drawer.py @@ -16,12 +16,10 @@ import os import math -from test.visual import VisualTestUtilities from pathlib import Path import numpy as np from numpy import pi -from qiskit.test import QiskitTestCase from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, transpile from qiskit.providers.fake_provider import FakeTenerife, FakeBelemV2 from qiskit.visualization.circuit.circuit_visualization import circuit_drawer @@ -53,6 +51,8 @@ from qiskit.quantum_info import random_clifford from qiskit.quantum_info.random import random_unitary from qiskit.utils import optionals +from test.visual import VisualTestUtilities # pylint: disable=wrong-import-order +from test import QiskitTestCase # pylint: disable=wrong-import-order if optionals.HAS_MATPLOTLIB: from matplotlib.pyplot import close as mpl_close diff --git a/test/visual/mpl/graph/test_graph_matplotlib_drawer.py b/test/visual/mpl/graph/test_graph_matplotlib_drawer.py index 9bc87457bb41..73dd2e6f4961 100644 --- a/test/visual/mpl/graph/test_graph_matplotlib_drawer.py +++ b/test/visual/mpl/graph/test_graph_matplotlib_drawer.py @@ -14,11 +14,9 @@ import unittest import os -from test.visual import VisualTestUtilities from contextlib import contextmanager from pathlib import Path -from qiskit.test import QiskitTestCase from qiskit import QuantumCircuit from qiskit.utils import optionals from qiskit.visualization.state_visualization import state_drawer @@ -33,6 +31,8 @@ FakeManhattan, ) from qiskit.quantum_info import Statevector +from test import QiskitTestCase # pylint: disable=wrong-import-order +from test.visual import VisualTestUtilities # pylint: disable=wrong-import-order if optionals.HAS_MATPLOTLIB: from matplotlib.pyplot import close as mpl_close