code: def _docdir(request):
      """Grabbed from https://stackoverflow.com/a/46991331"""
      # Trigger ONLY for the doctests.
      doctest_plugin = request.config.pluginmanager.getplugin("doctest")
      if isinstance(request.node, doctest_plugin.DoctestItem):
          # Get the fixture dynamically by its name.
          tmpdir = pp.local(data_dir)
  
          # Chdir only for the duration of the test.
          with tmpdir.as_cwd():
              yield
  
      else:
          # For normal tests, we have to yield, since this is a yield-fixture.
          yield
  
file_path: nipype/nipype/conftest.py
imports: import os
  import shutil
  from tempfile import mkdtemp
  import pytest
  import numpy
  import py.path
label_desc: Use image node_id 2 for calling a global function with example usage: _docdir(request) without return types