Skip to content

Commit

Permalink
Merge pull request #200 from BoxiLi/test_warnings
Browse files Browse the repository at this point in the history
Cleaning a few warnings in the test
  • Loading branch information
BoxiLi committed May 7, 2023
2 parents 629f502 + 983bfde commit d6d1649
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
- name: Test with pytest and generate coverage report
run: |
pip install pytest-cov coveralls
pytest tests --strict-markers --cov=qutip_qip --cov-report=
pytest tests --strict-markers --cov=qutip_qip --cov-report= --color=yes
- name: Upload to Coveralls
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
Expand Down
2 changes: 1 addition & 1 deletion src/qutip_qip/device/cavityqed.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def _get_max_step(self):


class CavityQEDModel(Model):
"""
r"""
The physical model for a dispersive cavity-QED processor
(:obj:`.DispersiveCavityQED`).
It is a qubit-resonator model that describes a system composed of
Expand Down
2 changes: 1 addition & 1 deletion src/qutip_qip/device/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def get_control_labels(self):
return self.model.get_control_labels()

def get_control_latex(self):
"""
r"""
Get the latex string for each Hamiltonian.
It is used in the method :meth:`.Processor.plot_pulses`.
It is a list of dictionaries.
Expand Down
6 changes: 5 additions & 1 deletion tests/pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ markers =
slow: Mark a test as taking a long time to run, and so can be skipped with `pytest -m "not slow"`.
repeat(n): Repeat the given test 'n' times.
requires_cython: Mark that the given test requires Cython to be installed. Such tests will be skipped if Cython is not available.

filterwarnings =
error
; ImportWarning: PyxImporter.find_spec() not found
ignore:PyxImporter:ImportWarning
; DeprecationWarning: Please use `upcast` from the `scipy.sparse` namespace
ignore::DeprecationWarning:qutip.fastsparse*:
ignore:matplotlib not found:UserWarning
ignore:the imp module is deprecated in favour of importlib:DeprecationWarning
ignore:Dedicated options class are no longer needed, options should be passed as dict to solvers.:FutureWarning
5 changes: 1 addition & 4 deletions tests/test_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,7 @@ def test_numerical_circuit(circuit, device_class, kwargs, schedule_mode):
"processor_class",
[DispersiveCavityQED, LinearSpinChain, CircularSpinChain, SCQubits])
def test_pulse_plotting(processor_class):
try:
import matplotlib.pyplot as plt
except Exception:
return True
plt = pytest.importorskip("matplotlib.pyplot")
qc = QubitCircuit(3)
qc.add_gate("CNOT", 1, 0)
qc.add_gate("X", 1)
Expand Down
6 changes: 2 additions & 4 deletions tests/test_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,8 @@ def test_plot(self):
"""
Test for plotting functions
"""
try:
import matplotlib.pyplot as plt
except Exception:
return True
plt = pytest.importorskip("matplotlib.pyplot")

# step_func
tlist = np.linspace(0., 2*np.pi, 20)
processor = Processor(N=1, spline_kind="step_func")
Expand Down
5 changes: 1 addition & 4 deletions tests/test_vqa.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,8 @@ def test_plot(self, todo):
"""
Check plotting function returns without error
"""
plt = pytest.importorskip("matplotlib.pyplot")
# Only test on environments that have the matplotlib dependency
try:
import matplotlib.pyplot as plt
except Exception:
return True
vqa = VQA(num_qubits=4, num_layers=1, cost_method="STATE")
for i in range(4):
vqa.add_block(VQABlock("X", targets=[i]))
Expand Down

0 comments on commit d6d1649

Please sign in to comment.