class_docstr: Enable automatic doctest integration to unittest.
  
  Every module in the pythran package is scanned for doctests
  and one test per module is created
docstr: replace '$>' with '>>>' and execute theses command lines by creating a shell
  return the path of the new adapted tmp file
docstr_tok: ["replace","'","$",">","'","with","'",">",">",">","'","and","execute","theses","command","lines","by","creating","a","shell","return","the","path","of","the","new","adapted","tmp","file"]
code: def adapt_rst(self, relative_path):
      """
      replace '$>' with '>>>' and execute theses command lines by creating a shell
      return the path of the new adapted tmp file
      """
      import re
      from tempfile import NamedTemporaryFile
  
      filepath = os.path.join(os.path.dirname(__file__), relative_path)
      with open(filepath) as rst_doc:
          # hidden doctest
          sp = re.sub(r"\.\.(\s+>>>)", r"\1", rst_doc.read())
          sp = re.sub(
              r"^([ ]+)$", r"\1<BLANKLINE>", sp, flags=re.MULTILINE
          )
          # harmonize argparse output after python 3.10
          if sys.version_info >= (3, 10):
              sp = sp.replace("optional arguments:", "options:")
  
      # hack to support setuptools-generated pythran / pythran-config scripts
      for tool, sub in (
          ("pythran-config", "python -m pythran.config"),
          ("pythran", "python -m pythran.run"),
          ("python", sys.executable),
      ):
          sp = re.sub(
              r"(\$>.*?[^#])\b" + tool + r"\b([^-.].*)$",
              r"\1" + sub + r"\2",
              sp,
              flags=re.MULTILINE,
          )
  
      # convert shell doctest into python ones
      sp = re.sub(
          r"\$>(.*?)$",
          r'>>> import subprocess ; res = subprocess.check_output("\1", shell=True).decode("ascii").strip() ; print(res, end="")',
          sp,
          flags=re.MULTILINE,
      )
      f = NamedTemporaryFile("w", delete=False)
      f.write(sp)
      f.close()
      return f.name
  
file_path: pythran/pythran/tests/test_xdoc.py
imports: import doctest
  import inspect
  import os
  import pytest
  import sys
  import unittest
  import pythran
  from pythran import transformations, analyses, optimizations, types, log
label_desc: Use image node_id 4 for calling the TestDoctest obj's underlying member method code with example usage: obj.adapt_rst(relative_path) and returns: f