code: def config_app(tempdir, conf_file):
      _fixturedir = os.path.join(os.path.dirname(__file__), "testconfs")
      srcdir = os.path.join(tempdir, "config_test")
      shutil.copytree(_fixturedir, srcdir)
      shutil.copytree(
          os.path.join(_fixturedir, "src"),
          os.path.join(tempdir, "examples"),
      )
  
      with open(os.path.join(srcdir, "conf.py"), "w") as conffile:
          conffile.write(conf_file["content"])
  
      app = Sphinx(
          srcdir,
          srcdir,
          os.path.join(srcdir, "_build"),
          os.path.join(srcdir, "_build", "toctree"),
          "html",
          warning=MixedEncodingStringIO(),
      )
  
      sphinx_compatibility._app = app
      return app
  
file_path: tensorly/doc/sphinx_ext/sphinx_gallery/tests/test_gen_gallery.py
imports: from __future__ import division, absolute_import, print_function, unicode_literals
  import os
  import tempfile
  import shutil
  import pytest
  from sphinx.application import Sphinx
  from sphinx.errors import ExtensionError
  from sphinx_gallery.gen_rst import MixedEncodingStringIO
  from sphinx_gallery.gen_gallery import DEFAULT_GALLERY_CONF
  from sphinx_gallery import sphinx_compatibility
label_desc: Use image node_id 3 for calling a global function with example usage: config_app(tempdir, conf_file) and returns: app