Skip to content

Commit

Permalink
Comment out backends in fake provider and Aer run method for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
HuangJunye committed Mar 4, 2022
1 parent fa4f142 commit 2127b34
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 113 deletions.
52 changes: 28 additions & 24 deletions qiskit/test/mock/fake_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,28 +419,32 @@ def run(self, run_input, **kwargs):
"Invalid input object %s, must be either a "
"QuantumCircuit, Schedule, or a list of either" % circuits
)
if _optionals.HAS_AER:
from qiskit.providers import aer

if pulse_job:
from qiskit.providers.aer.pulse import PulseSystemModel

system_model = PulseSystemModel.from_backend(self)
sim = aer.Aer.get_backend("pulse_simulator")
job = sim.run(circuits, system_model=system_model, **kwargs)
else:
sim = aer.Aer.get_backend("qasm_simulator")
if self.properties():
from qiskit.providers.aer.noise import NoiseModel

noise_model = NoiseModel.from_backend(self, warnings=False)
job = sim.run(circuits, noise_model=noise_model, **kwargs)
else:
job = sim.run(circuits, **kwargs)
else:
if pulse_job:
raise QiskitError("Unable to run pulse schedules without qiskit-aer installed")
warnings.warn("Aer not found using BasicAer and no noise", RuntimeWarning)
sim = basicaer.BasicAer.get_backend("qasm_simulator")
job = sim.run(circuits, **kwargs)
# if _optionals.HAS_AER:
# from qiskit.providers import aer

# if pulse_job:
# from qiskit.providers.aer.pulse import PulseSystemModel

# system_model = PulseSystemModel.from_backend(self)
# sim = aer.Aer.get_backend("pulse_simulator")
# job = sim.run(circuits, system_model=system_model, **kwargs)
# else:
# sim = aer.Aer.get_backend("qasm_simulator")
# if self.properties():
# from qiskit.providers.aer.noise import NoiseModel

# noise_model = NoiseModel.from_backend(self, warnings=False)
# job = sim.run(circuits, noise_model=noise_model, **kwargs)
# else:
# job = sim.run(circuits, **kwargs)
# else:
# if pulse_job:
# raise QiskitError("Unable to run pulse schedules without qiskit-aer installed")
# warnings.warn("Aer not found using BasicAer and no noise", RuntimeWarning)
# sim = basicaer.BasicAer.get_backend("qasm_simulator")
# job = sim.run(circuits, **kwargs)

warnings.warn("Aer not found using BasicAer and no noise", RuntimeWarning)
sim = basicaer.BasicAer.get_backend("qasm_simulator")
job = sim.run(circuits, **kwargs)
return job
178 changes: 89 additions & 89 deletions qiskit/test/mock/fake_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,52 +48,52 @@ def backends(self, name=None, **kwargs):

def __init__(self):
self._backends = [
FakeAlmaden(),
FakeArmonk(),
FakeAthens(),
FakeBelem(),
FakeBoeblingen(),
FakeBogota(),
FakeBrooklyn(),
FakeBurlington(),
FakeCairo(),
FakeCambridge(),
FakeCambridgeAlternativeBasis(),
FakeCasablanca(),
FakeEssex(),
FakeGuadalupe(),
FakeHanoi(),
FakeJakarta(),
FakeJohannesburg(),
FakeKolkata(),
FakeLagos(),
FakeLima(),
FakeLondon(),
FakeManila(),
FakeManhattan(),
FakeMelbourne(),
FakeMontreal(),
FakeMumbai(),
FakeNairobi(),
FakeOpenPulse2Q(),
FakeOpenPulse3Q(),
FakeOurense(),
FakeParis(),
FakePoughkeepsie(),
FakeQasmSimulator(),
FakeQuito(),
FakeRochester(),
FakeRome(),
FakeRueschlikon(),
FakeSantiago(),
FakeSingapore(),
FakeSydney(),
FakeTenerife(),
FakeTokyo(),
FakeToronto(),
FakeValencia(),
FakeVigo(),
FakeWashington(),
# FakeAlmaden(),
# FakeArmonk(),
# FakeAthens(),
# FakeBelem(),
# FakeBoeblingen(),
# FakeBogota(),
# FakeBrooklyn(),
# FakeBurlington(),
# FakeCairo(),
# FakeCambridge(),
# FakeCambridgeAlternativeBasis(),
# FakeCasablanca(),
# FakeEssex(),
# FakeGuadalupe(),
# FakeHanoi(),
# FakeJakarta(),
# FakeJohannesburg(),
# FakeKolkata(),
# FakeLagos(),
# FakeLima(),
# FakeLondon(),
# FakeManila(),
# FakeManhattan(),
# FakeMelbourne(),
# FakeMontreal(),
# FakeMumbai(),
# FakeNairobi(),
# FakeOpenPulse2Q(),
# FakeOpenPulse3Q(),
# FakeOurense(),
# FakeParis(),
# FakePoughkeepsie(),
# FakeQasmSimulator(),
# FakeQuito(),
# FakeRochester(),
# FakeRome(),
# FakeRueschlikon(),
# FakeSantiago(),
# FakeSingapore(),
# FakeSydney(),
# FakeTenerife(),
# FakeTokyo(),
# FakeToronto(),
# FakeValencia(),
# FakeVigo(),
# FakeWashington(),
FakeYorktown(),
]

Expand Down Expand Up @@ -162,39 +162,39 @@ def backends(self, name=None, **kwargs):

def __init__(self):
self._backends = [
FakeLegacyAlmaden(),
FakeLegacyArmonk(),
FakeLegacyAthens(),
FakeLegacyBelem(),
FakeLegacyBoeblingen(),
FakeLegacyBogota(),
FakeLegacyBurlington(),
FakeLegacyCambridge(),
FakeLegacyCambridgeAlternativeBasis(),
FakeLegacyCasablanca(),
FakeLegacyEssex(),
FakeLegacyJohannesburg(),
FakeLegacyLima(),
FakeLegacyLondon(),
FakeLegacyManhattan(),
FakeLegacyMelbourne(),
FakeLegacyMontreal(),
FakeLegacyMumbai(),
FakeLegacyOurense(),
FakeLegacyParis(),
FakeLegacyPoughkeepsie(),
FakeLegacyQuito(),
FakeLegacyRochester(),
FakeLegacyRome(),
FakeLegacyRueschlikon(),
FakeLegacySantiago(),
FakeLegacySingapore(),
FakeLegacySydney(),
FakeLegacyTenerife(),
FakeLegacyTokyo(),
FakeLegacyToronto(),
FakeLegacyValencia(),
FakeLegacyVigo(),
# FakeLegacyAlmaden(),
# FakeLegacyArmonk(),
# FakeLegacyAthens(),
# FakeLegacyBelem(),
# FakeLegacyBoeblingen(),
# FakeLegacyBogota(),
# FakeLegacyBurlington(),
# FakeLegacyCambridge(),
# FakeLegacyCambridgeAlternativeBasis(),
# FakeLegacyCasablanca(),
# FakeLegacyEssex(),
# FakeLegacyJohannesburg(),
# FakeLegacyLima(),
# FakeLegacyLondon(),
# FakeLegacyManhattan(),
# FakeLegacyMelbourne(),
# FakeLegacyMontreal(),
# FakeLegacyMumbai(),
# FakeLegacyOurense(),
# FakeLegacyParis(),
# FakeLegacyPoughkeepsie(),
# FakeLegacyQuito(),
# FakeLegacyRochester(),
# FakeLegacyRome(),
# FakeLegacyRueschlikon(),
# FakeLegacySantiago(),
# FakeLegacySingapore(),
# FakeLegacySydney(),
# FakeLegacyTenerife(),
# FakeLegacyTokyo(),
# FakeLegacyToronto(),
# FakeLegacyValencia(),
# FakeLegacyVigo(),
FakeLegacyYorktown(),
]

Expand Down Expand Up @@ -230,34 +230,34 @@ def __init__(self):
# FakeBoeblingenV2(),
# FakeBogotaV2(),
# FakeBrooklynV2(),
# # FakeBurlingtonV2(),
# FakeBurlingtonV2(),
# FakeCairoV2(),
# # FakeCambridgeV2(),
# FakeCambridgeV2(),
# # FakeCambridgeAlternativeBasisV2(),
# FakeCasablancaV2(),
# # FakeEssexV2(),
# FakeEssexV2(),
# FakeGuadalupeV2(),
# FakeHanoiV2(),
# FakeJakartaV2(),
# FakeJohannesburgV2(),
# FakeKolkataV2(),
# FakeLagosV2(),
# FakeLimaV2(),
# # FakeLondonV2(),
# FakeLondonV2(),
# FakeManhattanV2(),
# FakeManilaV2(),
# # FakeMelbourneV2(),
# FakeMelbourneV2(),
# FakeMontrealV2(),
# FakeMumbaiV2(),
# FakeNairobiV2(),
FakeNairobiV2(),
# # FakeOpenPulse2QV2(),
# # FakeOpenPulse3QV2(),
# # FakeOurenseV2(),
# FakeOurenseV2(),
# FakeParisV2(),
# FakePoughkeepsieV2(),
# # FakeQasmSimulatorV2(),
# FakeQuitoV2(),
# # FakeRochesterV2(),
# FakeRochesterV2(),
# FakeRomeV2(),
# # FakeRueschlikonV2(),
# FakeSantiagoV2(),
Expand All @@ -267,8 +267,8 @@ def __init__(self):
# # FakeTokyoV2(),
# FakeTorontoV2(),
# FakeValenciaV2(),
FakeVigoV2(),
# # FakeWashingtonV2(),
# FakeVigoV2(),
# FakeWashingtonV2(),
# # FakeYorktownV2(),
]

Expand Down

0 comments on commit 2127b34

Please sign in to comment.