mirror of
https://github.com/rasterio/rasterio.git
synced 2025-12-08 17:36:12 +00:00
Ensure MemoryFile is removed
This commit is contained in:
parent
2d03100fcc
commit
bf1ad79fa2
@ -261,7 +261,7 @@ class Env:
|
||||
return local._env._dump_open_datasets()
|
||||
|
||||
def _dump_vsimem(self):
|
||||
"""Returns contents of /vsimem/.
|
||||
"""Writes contents of /vsimem/.
|
||||
|
||||
For debugging and testing purposes.
|
||||
"""
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
"""Tests of the rasterio.vrt module"""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import rasterio
|
||||
import rasterio.vrt
|
||||
|
||||
@ -32,3 +34,14 @@ def test_virtual_dataset(path_rgb_byte_tif):
|
||||
assert rgb.dtypes == vrt.dtypes
|
||||
assert rgb.mask_flag_enums == vrt.mask_flag_enums
|
||||
|
||||
|
||||
def test_virtual_dataset_invalid():
|
||||
doc = "<VRTDataset></VRTDataset>"
|
||||
with rasterio.Env() as env:
|
||||
with rasterio.vrt.VirtualDataset.fromstring(doc) as vrtfile:
|
||||
print(vrtfile._memfile.name)
|
||||
|
||||
assert vrtfile._memfile.closed
|
||||
assert Path(vrtfile._memfile.name).parent.as_posix() not in [
|
||||
"/vsimem/" + item for item in env._dump_vsimem()
|
||||
]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user