Exemple #1
0
    def tearDown(self):
        super().tearDown()
        # Reset the default providers, as in practice they acts as a singleton
        # due to importing the instances from the top-level qiskit namespace.
        from qiskit.providers.basicaer import BasicAer

        BasicAer._backends = BasicAer._verify_backends()
Exemple #2
0
    def tearDown(self):
        # Reset the default providers, as in practice they acts as a singleton
        # due to importing the wrapper from qiskit.
        from qiskit.providers.ibmq import IBMQ
        IBMQ._providers.clear()
        IBMQ._credentials = None

        from qiskit.providers.basicaer import BasicAer
        BasicAer._backends = BasicAer._verify_backends()
Exemple #3
0
    def tearDown(self):
        # Reset the default providers, as in practice they acts as a singleton
        # due to importing the wrapper from qiskit.
        try:
            from qiskit.providers.ibmq import IBMQ
            IBMQ._accounts.clear()
        except ImportError:
            pass
        from qiskit.providers.basicaer import BasicAer

        BasicAer._backends = BasicAer._verify_backends()
Exemple #4
0
    def tearDownClass(cls) -> None:
        # Reset the default providers, as in practice they acts as a singleton
        # due to importing the wrapper from qiskit.
        from qiskit.providers.ibmq import IBMQ
        try:
            IBMQ.disable_account()
        except IBMQAccountCredentialsNotFound:
            pass

        from qiskit.providers.basicaer import BasicAer
        BasicAer._backends = BasicAer._verify_backends()
Exemple #5
0
    def tearDown(self):
        super().tearDown()
        if self.__teardown_called:
            raise ValueError(
                "In File: %s\n"
                "TestCase.tearDown was already called. Do not explicitly call "
                "tearDown from your tests. In your own tearDown, use super to "
                "call the base tearDown." %
                (sys.modules[self.__class__.__module__].__file__, ))
        self.__teardown_called = True
        # Reset the default providers, as in practice they acts as a singleton
        # due to importing the instances from the top-level qiskit namespace.
        from qiskit.providers.basicaer import BasicAer

        BasicAer._backends = BasicAer._verify_backends()