Skip to content

Commit

Permalink
[FIX] Restore compatibility with pytest 8.0.0 (#637)
Browse files Browse the repository at this point in the history
  • Loading branch information
HGSilveri authored Feb 1, 2024
1 parent f1637ae commit 154e9b3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
6 changes: 3 additions & 3 deletions tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ def create_noise_model(param, value):
}
)
with pytest.warns(
DeprecationWarning,
match=f"{param} is deprecated.",
(UserWarning, DeprecationWarning),
match=f"{param}",
):
return NoiseModel(**{param: value})
return NoiseModel(**{param: value})
Expand Down Expand Up @@ -213,7 +213,7 @@ def test_eff_noise_probs(self, matrices):
eff_noise_rates=[-1.0, 0.5],
)
with pytest.warns(
DeprecationWarning, match="eff_noise_probs is deprecated."
(UserWarning, DeprecationWarning), match="eff_noise_probs"
):
NoiseModel(
noise_types=("eff_noise",),
Expand Down
35 changes: 17 additions & 18 deletions tests/test_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,27 +595,26 @@ def test_switch_device_down(
ValueError,
match="No match for channel raman_1 with the" " same clock_period.",
):
with pytest.warns(DeprecationWarning, match="From v0.17"):
# Can't find a match for the 2nd rydberg_local
seq.switch_device(
dataclasses.replace(
phys_Chadoq2,
channel_objects=(
DigitalAnalogDevice.channels["rydberg_global"],
dataclasses.replace(
DigitalAnalogDevice.channels["raman_local"],
clock_period=10,
),
# Can't find a match for the 2nd rydberg_local
seq.switch_device(
dataclasses.replace(
phys_Chadoq2,
channel_objects=(
DigitalAnalogDevice.channels["rydberg_global"],
dataclasses.replace(
DigitalAnalogDevice.channels["raman_local"],
clock_period=10,
),
channel_ids=(
"rydberg_global",
"rydberg_local",
"rydberg_local1",
),
DigitalAnalogDevice.channels["raman_local"],
),
strict=True,
)
channel_ids=(
"rydberg_global",
"rydberg_local",
"rydberg_local1",
),
),
strict=True,
)

# From sequence reusing DMMs to Device without reusable channels
seq = init_seq(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ def test_noisy_xy():
with pytest.raises(
NotImplementedError, match="mode 'XY' does not support simulation of"
):
with pytest.warns(DeprecationWarning, match="is_deprecated"):
with pytest.warns(DeprecationWarning, match="is deprecated"):
sim._hamiltonian.set_config(
SimConfig(("SPAM", "doppler")).to_noise_model()
)
Expand Down

0 comments on commit 154e9b3

Please sign in to comment.