Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/changes/newsfragments/8552.underthehood
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The test suite no longer depends on ``deepdiff``. The tests that used it now compare the data directly
using ``InterDependencies`` equality and ``numpy.testing.assert_array_equal``.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ minicircuits_rudat = ["pywinusb>=0.4.2"]
loop = ["qcodes_loop>=0.1.2"]
test = [
"coverage[toml]>=7.10.5",
"deepdiff>=8.6.1",
"hypothesis>=6.130.0",
"lxml>=4.9.4",
"lxml-stubs>=0.4.0",
Expand Down
6 changes: 0 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ broadbean==0.15.0
# via
# qcodes (pyproject.toml)
# qcodes
cachebox==5.2.3
# via deepdiff
certifi==2026.7.22
# via requests
cf-xarray==0.11.3
Expand Down Expand Up @@ -70,8 +68,6 @@ debugpy==1.8.22
# via ipykernel
decorator==5.3.1
# via ipython
deepdiff==9.1.0
# via qcodes (pyproject.toml)
defusedxml==0.7.1
# via nbconvert
docutils==0.21.2
Expand Down Expand Up @@ -241,8 +237,6 @@ opentelemetry-api==1.44.0
# via
# qcodes (pyproject.toml)
# qcodes
orderly-set==5.5.0
# via deepdiff
packaging==26.3
# via
# qcodes (pyproject.toml)
Expand Down
32 changes: 23 additions & 9 deletions tests/dataset/test_converters.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from deepdiff import DeepDiff # type: ignore[import-untyped]

from qcodes.dataset.descriptions.rundescriber import RunDescriber
from qcodes.dataset.descriptions.versioning.converters import (
new_to_old,
Expand Down Expand Up @@ -66,11 +64,11 @@ def _assert_dicts_are_related_as_expected(v0, v1, v2):
assert v1["version"] == 1
assert len(v1) == 2

# conversion does not preserve order in the dict so use deepdiff to compare
assert (
DeepDiff(v2["interdependencies"], v0["interdependencies"], ignore_order=True)
== {}
)
# conversion does not preserve the order of the paramspecs so compare
# via InterDependencies whose equality ignores that order
assert InterDependencies._from_dict(
v2["interdependencies"]
) == InterDependencies._from_dict(v0["interdependencies"])
assert v2["interdependencies_"] == v1["interdependencies"]
assert v2["version"] == 2
assert len(v2) == 3
Expand All @@ -93,8 +91,24 @@ def test_construct_current_rundescriber_from_v0(some_paramspecs) -> None:
version=3,
shapes=None,
)
assert DeepDiff(rds1._to_dict(), expected_v3_dict, ignore_order=True) == {}
assert DeepDiff(rds_upgraded._to_dict(), expected_v3_dict, ignore_order=True) == {}
_assert_v3_dicts_equal_up_to_paramspec_order(rds1._to_dict(), expected_v3_dict)
_assert_v3_dicts_equal_up_to_paramspec_order(
rds_upgraded._to_dict(), expected_v3_dict
)


def _assert_v3_dicts_equal_up_to_paramspec_order(
actual: RunDescriberV3Dict, expected: RunDescriberV3Dict
) -> None:
# conversion from v0 does not preserve the order of the old style
# paramspecs so compare those via InterDependencies whose equality
# ignores that order. All other entries must match exactly.
assert InterDependencies._from_dict(
actual["interdependencies"]
) == InterDependencies._from_dict(expected["interdependencies"])
assert {k: v for k, v in actual.items() if k != "interdependencies"} == {
k: v for k, v in expected.items() if k != "interdependencies"
}


def test_construct_current_rundescriber_from_v1(some_interdeps) -> None:
Expand Down
13 changes: 8 additions & 5 deletions tests/dataset/test_dataset_in_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
import numpy as np
import pytest
import xarray as xr
from deepdiff import DeepDiff # type: ignore[import-untyped]
from hypothesis import HealthCheck, given, settings
from numpy.testing import assert_almost_equal
from numpy.testing import assert_almost_equal, assert_array_equal

import qcodes
from qcodes.dataset import Measurement, load_by_id, load_by_run_spec
Expand Down Expand Up @@ -727,6 +726,10 @@ def test_dataset_in_mem_with_inferred_parameters(
cache_data = ds.cache.data()

assert set(param_data.keys()) == set(cache_data.keys())
assert set(param_data["dependent"].keys()) == set(cache_data["dependent"].keys())

assert DeepDiff(param_data, cache_data, ignore_nan_inequality=True) == {}
for outer_key, param_subdict in param_data.items():
cache_subdict = cache_data[outer_key]
assert set(param_subdict.keys()) == set(cache_subdict.keys())
for inner_key, param_array in param_subdict.items():
# assert_array_equal treats NaNs in the same positions as equal
# and strict=True also requires matching shape and dtype
assert_array_equal(param_array, cache_subdict[inner_key], strict=True)
Loading