Skip to content

Commit

Permalink
Remove qiskit.test (#10998)
Browse files Browse the repository at this point in the history
* remove qiskit.test

* add test/utils

* reno

* replace

* reajust

* revert test/python/transpiler/test_passmanager_config.py

* randomized

* test/benchmarks

* pylint and order

* missing file

* revert test/python/transpiler/test_passmanager_config.py

* linting

* add new tests

* on the base module

* reno
  • Loading branch information
1ucian0 authored Jan 31, 2024
1 parent f1fa4f2 commit e0b435e
Show file tree
Hide file tree
Showing 346 changed files with 468 additions and 491 deletions.
5 changes: 5 additions & 0 deletions releasenotes/notes/remove_qiskit_test-84bee228d8d768df.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
upgrade:
- |
Remove ``qiskit.test``. This includes ``qiskit.test.QiskitTestCase`` (and ``BasicQiskitTestCase``)
which are now for interal unittesting use.
3 changes: 3 additions & 0 deletions test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""<no description>"""
Expand Down
2 changes: 1 addition & 1 deletion test/benchmarks/transpiler_qualitative.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/classical/test_expr_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/classical/test_expr_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions test/python/circuit/classical/test_expr_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/classical/test_types_ordering.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_adders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_blueprintcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import unittest
from ddt import ddt, data

from qiskit.test.base import QiskitTestCase
from qiskit.circuit import (
QuantumRegister,
Parameter,
Expand All @@ -26,6 +25,7 @@
CircuitInstruction,
)
from qiskit.circuit.library import BlueprintCircuit, XGate
from test import QiskitTestCase # pylint: disable=wrong-import-order


class MockBlueprint(BlueprintCircuit):
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_boolean_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_diagonal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_evolution_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_evolved_op_ansatz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_fourier_checking.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
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,
PolynomialPauliRotations,
PiecewiseLinearPauliRotations,
)
from qiskit.quantum_info import Statevector
from test import QiskitTestCase # pylint: disable=wrong-import-order


@ddt
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_global_r.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_gms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_graph_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_grover_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_hidden_linear_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_integer_comparator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_iqp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions test/python/circuit/library/test_linear_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_mcmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_multipliers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -26,6 +25,7 @@
DraperQFTAdder,
VBERippleCarryAdder,
)
from test import QiskitTestCase # pylint: disable=wrong-import-order


@ddt
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_nlocal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_overlap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 1 addition & 2 deletions test/python/circuit/library/test_pauli_feature_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_permutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 1 addition & 2 deletions test/python/circuit/library/test_phase_estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_phase_oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Loading

0 comments on commit e0b435e

Please sign in to comment.