Skip to content

Commit a99e1f0

Browse files
committed
Try fix: Closes open file (for Windows error)
``` WindowsError: [Error 32] The process cannot access the file because it is being used by another process ```
1 parent 283c80f commit a99e1f0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

xarray/tests/test_backends.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,10 +1044,9 @@ def test_read_byte_attrs_as_unicode(self):
10441044
with create_tmp_file() as tmp_file:
10451045
with nc4.Dataset(tmp_file, 'w') as nc:
10461046
nc.foo = b'bar'
1047-
actual = open_dataset(tmp_file)
1048-
expected = Dataset(attrs={'foo': 'bar'})
1049-
self.assertDatasetIdentical(expected, actual)
1050-
actual.close()
1047+
with open_dataset(tmp_file) as actual:
1048+
expected = Dataset(attrs={'foo': 'bar'})
1049+
self.assertDatasetIdentical(expected, actual)
10511050

10521051
def test_encoding_unlimited_dims(self):
10531052
ds = Dataset({'x': ('y', np.arange(10.0))})

0 commit comments

Comments
 (0)