code: def test_no_write_driver_cannot_write(
      tmpdir, driver, testdata_generator, monkeypatch
  ):
      """Test if read only driver cannot write."""
      monkeypatch.setitem(
          fiona.drvsupport.supported_drivers, driver, "rw"
      )
      schema, crs, records1, _, _ = testdata_generator(
          driver, range(0, 5), []
      )
  
      if driver == "BNA" and GDALVersion.runtime() < GDALVersion(2, 0):
          pytest.skip("BNA driver segfaults with gdal 1.11")
  
      if driver == "FlatGeobuf":
          pytest.xfail(
              "FlatGeobuf doesn't raise an error but doesn't have write support"
          )
  
      path = str(tmpdir.join(get_temp_filename(driver)))
  
      with pytest.raises(Exception):
          with fiona.open(
              path, "w", driver=driver, crs=crs, schema=schema
          ) as c:
              c.writerecords(records1)
  
file_path: Fiona/tests/test_drvsupport.py
imports: import logging
  import pytest
  from .conftest import requires_gdal24, get_temp_filename
  from fiona.drvsupport import supported_drivers, driver_mode_mingdal
  import fiona.drvsupport
  from fiona.env import GDALVersion
  from fiona._env import calc_gdal_version_num, get_gdal_version_num
  from fiona.errors import DriverError
label_desc: Use image node_id 6 for calling a global function with example usage: test_no_write_driver_cannot_write(tmpdir, driver, testdata_generator, monkeypatch) without return types