code: def test_serialize_filesystem_factory(tmpdir):
      SimpleSchema = Unischema(
          "SimpleSchema",
          [
              UnischemaField(
                  "id", np.int32, (), ScalarCodec(IntegerType()), False
              ),
              UnischemaField(
                  "foo", np.int32, (), ScalarCodec(IntegerType()), False
              ),
          ],
      )
  
      class BogusFS(pyarrow.LocalFileSystem):
          def __getstate__(self):
              raise RuntimeError("can not serialize")
  
      rows_count = 10
      output_url = "file://{0}/fs_factory_test".format(tmpdir)
      rowgroup_size_mb = 256
      spark = (
          SparkSession.builder.config("spark.driver.memory", "2g")
          .master("local[2]")
          .getOrCreate()
      )
      sc = spark.sparkContext
      with materialize_dataset(
          spark,
          output_url,
          SimpleSchema,
          rowgroup_size_mb,
          filesystem_factory=BogusFS,
      ):
          rows_rdd = (
              sc.parallelize(range(rows_count))
              .map(lambda x: {"id": x, "foo": x})
              .map(lambda x: dict_to_spark_row(SimpleSchema, x))
          )
  
          spark.createDataFrame(
              rows_rdd, SimpleSchema.as_spark_schema()
          ).write.parquet(output_url)
  
file_path: petastorm/petastorm/tests/test_dataset_metadata.py
imports: import numpy
  import pytest
  import pyarrow
  from pyspark.sql import SparkSession
  from pyspark.sql.types import IntegerType
  from petastorm.codecs import ScalarCodec
  from petastorm.etl.dataset_metadata import get_schema_from_dataset_url, materialize_dataset
  from petastorm.tests.test_common import TestSchema
  from petastorm.unischema import Unischema, UnischemaField, dict_to_spark_row
label_desc: Use image node_id 3 for calling a global function with example usage: test_serialize_filesystem_factory(tmpdir) without return types