Skip to content

Commit 7226b36

Browse files
committed
Confine split-attrs usage.
1 parent 39d8253 commit 7226b36

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

lib/iris/tests/integration/netcdf/test_load_managed_attributes.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@
2626
from iris.warnings import IrisLoadWarning
2727

2828

29-
@pytest.fixture(autouse=True, scope="session")
30-
def iris_futures():
31-
iris.FUTURE.save_split_attrs = True
32-
33-
3429
class LoadTestCommon:
3530
@pytest.fixture(autouse=True)
3631
def tmp_filepath(self, tmp_path_factory):
@@ -43,7 +38,9 @@ def _check_load_inner(self, iris_name, nc_name, value):
4338
# quickly create a valid netcdf file with a simple cube in it.
4439
cube = Cube([1], var_name="x")
4540
# Save : NB can fail
46-
iris.save(cube, self.tmp_ncpath)
41+
with iris.FUTURE.context(save_split_attrs=True):
42+
iris.save(cube, self.tmp_ncpath)
43+
4744
# Reopen for updating with netcdf
4845
ds = NcDataset(self.tmp_ncpath, "r+")
4946
# Add the test attribute content.

lib/iris/tests/integration/netcdf/test_save_managed_attributes.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818
from iris.fileformats.pp import STASH
1919

2020

21-
@pytest.fixture(autouse=True, scope="session")
22-
def iris_futures():
23-
iris.FUTURE.save_split_attrs = True
24-
25-
2621
class SaveTestCommon:
2722
@pytest.fixture(autouse=True)
2823
def tmp_filepath(self, tmp_path_factory):
@@ -34,7 +29,9 @@ def tmp_filepath(self, tmp_path_factory):
3429
def _check_save_inner(self, iris_name, nc_name, value):
3530
cube = Cube([1], var_name="x", attributes={iris_name: value})
3631
# Save : NB can fail
37-
iris.save(cube, self.tmp_ncpath)
32+
with iris.FUTURE.context(save_split_attrs=True):
33+
iris.save(cube, self.tmp_ncpath)
34+
3835
ds = NcDataset(self.tmp_ncpath)
3936
result = ds.variables["x"].getncattr(nc_name)
4037
return result

0 commit comments

Comments
 (0)