code: def collect(self):
      import doctest
  
      class MockAwareDocTestFinder(doctest.DocTestFinder):
          """
          a hackish doctest finder that overrides stdlib internals to fix a stdlib bug
  
          https://github.com/pytest-dev/pytest/issues/3456
          https://bugs.python.org/issue25532
          """
  
          def _find(
              self, tests, obj, name, module, source_lines, globs, seen
          ):
              if _is_mocked(obj):
                  return
              with _patch_unwrap_mock_aware():
                  doctest.DocTestFinder._find(
                      self,
                      tests,
                      obj,
                      name,
                      module,
                      source_lines,
                      globs,
                      seen,
                  )
  
      if self.fspath.basename == "conftest.py":
          module = self.config.pluginmanager._importconftest(
              self.fspath
          )
      else:
          try:
              module = self.fspath.pyimport()
          except ImportError:
              if self.config.getvalue("doctest_ignore_import_errors"):
                  pytest.skip(
                      "unable to import module %r" % self.fspath
                  )
              else:
                  raise
      # uses internal doctest module parsing mechanism
      finder = MockAwareDocTestFinder()
      optionflags = get_optionflags(self)
      runner = _get_runner(
          verbose=0,
          optionflags=optionflags,
          checker=_get_checker(),
          continue_on_failure=_get_continue_on_failure(self.config),
      )
  
      for test in finder.find(module, module.__name__):
          if test.examples:  # skip empty doctests
              yield DoctestItem(test.name, self, runner, test)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import inspect
  import platform
  import sys
  import traceback
  import warnings
  from contextlib import contextmanager
  import pytest
  from _pytest._code.code import ExceptionInfo
  from _pytest._code.code import ReprFileLocation
  from _pytest._code.code import TerminalRepr
  from _pytest.compat import safe_getattr
  from _pytest.fixtures import FixtureRequest
  from _pytest.outcomes import Skipped
  from _pytest.warning_types import PytestWarning
label_desc: Use image node_id 1 for calling the DoctestModule obj's underlying member method code with example usage: obj.collect() without return types