Skip to content

Commit

Permalink
Enable test_jupyter (#306)
Browse files Browse the repository at this point in the history
* enable test_jupyter

* update variable name

* trigger build

* trigger build

* update makefile

Co-authored-by: Rathish Cholarajan <rathishc24@gmail.com>
  • Loading branch information
kt474 and rathishcholarajan committed Apr 7, 2022
1 parent 08040fc commit a893b14
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 30 deletions.
7 changes: 1 addition & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@ unit-test-coverage:
coverage lcov

integration-test:
# TODO: enable all tests in "test/integration" directory
python -m unittest -v test/integration/test_backend.py test/integration/test_account_client.py test/integration/test_filter_backends.py \
test/integration/test_serialization.py test/integration/test_ibm_job_attributes.py test/integration/test_basic_server_paths.py \
test/integration/test_ibm_integration.py test/integration/test_ibm_job.py test/integration/test_ibm_qasm_simulator.py \
test/integration/test_proxies.py test/integration/test_ibm_provider.py test/integration/test_composite_job.py \
test/integration/test_websocket_integration.py
python -m unittest discover --verbose --top-level-directory . --start-directory test/integration

e2e-test:
python -m unittest discover --verbose --top-level-directory . --start-directory test/e2e
Expand Down
41 changes: 17 additions & 24 deletions test/integration/test_jupyter.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# pylint: disable-all
# type: ignore
# TODO: Reenable and fix integration tests.

# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
Expand Down Expand Up @@ -31,22 +27,23 @@
from qiskit_ibm_provider.jupyter.jobs_widget import jobs_tab
from qiskit_ibm_provider.jupyter.qubits_widget import qubits_tab
from qiskit_ibm_provider.visualization.interactive.error_map import iplot_error_map
from ..decorators import requires_provider
from ..decorators import (
IntegrationTestDependencies,
integration_test_setup,
)
from ..ibm_test_case import IBMTestCase


class TestBackendInfo(IBMTestCase):
"""Test backend information Jupyter widget."""

@classmethod
@requires_provider
def setUpClass(cls, provider, hub, group, project):
@integration_test_setup()
def setUpClass(cls, dependencies: IntegrationTestDependencies) -> None:
# pylint: disable=arguments-differ
super().setUpClass()
cls.hub = hub
cls.group = group
cls.project = project
cls.backends = _get_backends(provider)
cls.dependencies = dependencies
cls.backends = _get_backends(cls.dependencies.provider)

def test_config_tab(self):
"""Test config tab."""
Expand Down Expand Up @@ -94,37 +91,33 @@ class TestIBMDashboard(IBMTestCase):
"""Test backend information Jupyter widget."""

@classmethod
@requires_provider
def setUpClass(cls, provider, hub, group, project):
@integration_test_setup()
def setUpClass(cls, dependencies: IntegrationTestDependencies):
# pylint: disable=arguments-differ
super().setUpClass()
cls.provider = provider
cls.hub = hub
cls.group = group
cls.project = project
cls.backends = _get_backends(provider)
cls.dependencies = dependencies
cls.backends = _get_backends(cls.dependencies.provider)

def test_backend_widget(self):
"""Test devices tab."""
for backend in self.backends:
with self.subTest(backend=backend):
provider_str = "{}/{}/{}".format(
backend.hub, backend.group, backend.project
backend_with_providers = BackendWithProviders(
backend=backend, providers=[self.dependencies.instance]
)
b_w_p = BackendWithProviders(backend=backend, providers=[provider_str])
make_backend_widget(b_w_p)
make_backend_widget(backend_with_providers)

def test_job_widget(self):
"""Test jobs tab."""
backend = self.provider.get_backend("ibmq_qasm_simulator")
backend = self.dependencies.provider.get_backend("ibmq_qasm_simulator")
job = backend.run(transpile(ReferenceCircuits.bell(), backend))
create_job_widget(
mock.MagicMock(), job, backend=backend.name(), status=job.status().value
)

def test_watcher_monitor(self):
"""Test job watcher."""
backend = self.provider.get_backend("ibmq_qasm_simulator")
backend = self.dependencies.provider.get_backend("ibmq_qasm_simulator")
job = backend.run(transpile(ReferenceCircuits.bell(), backend))
_job_checker(job=job, status=job.status(), watcher=mock.MagicMock())

Expand Down

0 comments on commit a893b14

Please sign in to comment.