code: def test_issue2360_no_with(
      monkeypatch, request, capfd, rgb_file_object
  ):
      """Opening a file object without FilePath returns a dataset with attached MemoryFile."""
      monkeypatch.setattr(rasterio, "have_vsi_plugin", False)
      with rasterio.Env() as env:
          src = rasterio.open(rgb_file_object)
          assert src.driver == "GTiff"
          assert src.count == 3
          assert src.dtypes == ("uint8", "uint8", "uint8")
          assert src.read().shape == (3, 718, 791)
  
          env._dump_open_datasets()
          captured = capfd.readouterr()
          assert "/vsimem/{}".format(request.node.name) in captured.err
  
          # Closing src causes the attached MemoryFile context to be
          # exited and the temporary in-memory file is deleted.
          src.close()
          env._dump_open_datasets()
          captured = capfd.readouterr()
          assert (
              "/vsimem/{}".format(request.node.name) not in captured.err
          )
  
imports: from io import BytesIO
  import os.path
  from pathlib import Path
  from affine import Affine
  import numpy
  import pytest
  import rasterio
  from rasterio.io import MemoryFile, ZipMemoryFile
  from rasterio.enums import MaskFlags
  from rasterio.shutil import copyfiles
label_desc: Use image node_id 22 for calling a global function with example usage: test_issue2360_no_with(monkeypatch, request, capfd, rgb_file_object) without return types