code: def test_gen_dir_rst(gallery_conf, fakesphinxapp):
      """Test gen_dir_rst."""
      print(os.listdir(gallery_conf["examples_dir"]))
      fname_readme = os.path.join(gallery_conf["src_dir"], "README.txt")
      with open(fname_readme, "wb") as fid:
          fid.write("Testing\n=======\n\nÓscar here.".encode("utf-8"))
      args = (
          gallery_conf["src_dir"],
          gallery_conf["gallery_dir"],
          gallery_conf,
          [],
      )
      out = generate_dir_rst(*args)
      assert "Óscar here" in out[0]
  
imports: from __future__ import division, absolute_import, print_function, unicode_literals
  import ast
  import codecs
  import copy
  import logging
  import tempfile
  import re
  import os
  import shutil
  import zipfile
  import pytest
  import sphinx_gallery.gen_rst
  from sphinx_gallery import gen_gallery, downloads
  from sphinx_gallery.gen_gallery import generate_dir_rst
  from sphinx_gallery import sphinx_compatibility
  import matplotlib.pyplot
label_desc: Use image node_id 9 for calling a global function with example usage: test_gen_dir_rst(gallery_conf, fakesphinxapp) without return types