code: def setup_test():
      """Default package level setup routine for skimage tests.
  
      Import packages known to raise warnings, and then
      force warnings to raise errors.
  
      Also set the random seed to zero.
      """
      warnings.simplefilter("default")
  
      if _error_on_warnings:
          np.random.seed(0)
  
          warnings.simplefilter("error")
  
          warnings.filterwarnings(
              "default",
              message="unclosed file",
              category=ResourceWarning,
          )
  
          # Ignore other warnings only seen when using older versions of
          # dependencies.
          warnings.filterwarnings(
              "default",
              message="Conversion of the second argument of issubdtype",
              category=FutureWarning,
          )
  
          warnings.filterwarnings(
              "default",
              message="the matrix subclass is not the recommended way",
              category=PendingDeprecationWarning,
              module="numpy",
          )
  
          warnings.filterwarnings(
              "default",
              message="Your installed pillow version",
              category=UserWarning,
              module="skimage.io",
          )
  
          # ignore warning from cycle_spin about Dask not being installed
          warnings.filterwarnings(
              "default",
              message="The optional dask dependency is not installed.",
              category=UserWarning,
          )
  
          warnings.filterwarnings(
              "default",
              message="numpy.ufunc size changed",
              category=RuntimeWarning,
          )
  
          warnings.filterwarnings(
              "default",
              message="\n\nThe scipy.sparse array containers",
              category=DeprecationWarning,
          )
  
          # ignore dtype deprecation warning from NumPy arising from use of SciPy
          # as a reference in test_watershed09. Should be fixed in scipy>=1.9.4
          # https://github.com/scipy/scipy/commit/da3ff893b9ac161938e11f9bcd5380e09cf03150
          warnings.filterwarnings(
              "default",
              message=("`np.int0` is a deprecated alias for `np.intp`"),
              category=DeprecationWarning,
          )
  
          # Temporary warning raised by imageio about change in Pillow. May be removed
          # once https://github.com/python-pillow/Pillow/pull/7125 is shipped in the
          # minimal required version of pillow (probably the release after Pillow 9.5.0)
          warnings.filterwarnings(
              "default",
              message=(
                  r"Loading 16-bit \(uint16\) PNG as int32 due to limitations in "
                  r"pillow's PNG decoder\. This will be fixed in a future version of "
                  r"pillow which will make this warning dissapear\."
              ),
              category=UserWarning,
          )
  
          # Temporary warning raised by scipy. May be removed when scipy 1.12 is
          # minimum supported version and we replace tol with rtol
          warnings.filterwarnings(
              "default",
              message=(
                  "'scipy.sparse.linalg.cg' keyword argument `tol` is deprecated in "
                  "favor of `rtol`"
              ),
              category=DeprecationWarning,
          )
  
          warnings.filterwarnings(
              "default",
              message=("The figure layout has changed to tight"),
              category=UserWarning,
          )
  
imports: import os
  import re
  import struct
  import threading
  import functools
  from tempfile import NamedTemporaryFile
  import numpy
  from numpy import testing
  from numpy.testing import TestCase, assert_, assert_warns, assert_no_warnings, assert_equal, assert_almost_equal, assert_array_equal, assert_allclose, assert_array_almost_equal, assert_array_almost_equal_nulp, assert_array_less
  import warnings
  from ..None import data, io
  from ..data._fetchers import _fetch
  from ..util import img_as_uint, img_as_float, img_as_int, img_as_ubyte
  from ._warnings import expected_warnings
  import pytest
label_desc: Use image node_id 7 for calling a global function with example usage: setup_test() without return types