code: def test_render_outfile_differnt_parent(
      capsys,
      tmp_path,
      engine="dot",
      outfile="spam.pdf",
      source="graph { spam }",
  ):
      outfile = tmp_path / "rendered" / outfile
      outfile.parent.mkdir()
      assert not outfile.exists()
  
      filepath = tmp_path / "sources" / outfile.with_suffix(".gv").name
      filepath.parent.mkdir()
      assert (
          filepath.write_text(source)
          == len(source)
          == filepath.stat().st_size
      )
  
      result = graphviz.render(
          engine, filepath=filepath, outfile=outfile
      )
  
      assert result == os.fspath(outfile)
  
      assert outfile.exists()
      assert outfile.stat().st_size
  
      assert capsys.readouterr() == ("", "")
  
imports: import pathlib
  import os
  import shutil
  import subprocess
  import pytest
  import graphviz
  from graphviz import _tools
  from graphviz.backend import rendering
  import _common
label_desc: Use image node_id 6 for calling a global function with example usage: test_render_outfile_differnt_parent(capsys, tmp_path, engine, outfile, source) without return types