title: Pytesting Doctests in Visual Studio Code Debugger
body: <p>Suppose I have the following code in <code>foo.py</code>:</p>
  
  <pre><code>def start():
      """
      &gt;&gt;&gt; start()
      Hello world
      """
      test = 10
      print('Hello world')
  </code></pre>
  
  <p>Normally, I would run the doctest by running <code>pytest foo.py --doctest-modules -v</code> in the terminal. I instead want to be able to test it through Visual Studio Code's built-in debugger to track the variables and call stack.</p>
  
  <p>I have the following configuration in my project's <code>launch.json</code>:</p>
  
  <pre><code>"name": "PyTest",
  "type": "python",
  "request": "launch",
  "stopOnEntry": false,
  "pythonPath": "${config:python.pythonPath}",
  "module": "pytest",
  "args": [
      "${file}",
      "--doctest-modules",
      "-v"
  ],
  "cwd": "${workspaceRoot}",
  "env": {},
  "envFile": "${workspaceRoot}/.env",
  "debugOptions": [
      "RedirectOutput"
  ]
  </code></pre>
  
  <p>However, when I open the file and run the PyTest debugging configuration in the VSCode debugger, the doctests are only run in the built-in terminal - nothing shows up in the debugger panel. How should I configure the debugger to be able to use its variables and call stack?</p>