def test_deprecated_cpp_simulator_return_no_backend(self): """Test backends("local_qasm_simulator_cpp") does not return C++ simulator if it is not installed""" name = "local_qasm_simulator_cpp" backends = LegacySimulators.backends(name) if is_cpp_simulator_available(): self.assertEqual(len(backends), 1) self.assertIsInstance(backends[0] if backends else None, QasmSimulator) else: self.assertEqual(len(backends), 0)
def get_aer_backends(): try: backends = LegacySimulators.backends() logger.debug('Using LegacySimulators backends.') return backends except: pass backends = BasicAer.backends() logger.debug('Using BasicAer backends.') return backends