class_docstr: Factory for temporary directories under the common base temp directory.
  
  The base directory can be configured using the ``--basetemp`` option.
class_docstr_tok: ["Factory","for","temporary","directories","under","the","common","base","temp","directory",".","The","base","directory","can","be","configured","using","the","``","--","basetemp","``","option","."]
docstr: return base temporary directory. 
docstr_tok: ["return","base","temporary","directory","."]
code: def getbasetemp(self):
      """return base temporary directory."""
      if self._basetemp is not None:
          return self._basetemp
  
      if self._given_basetemp is not None:
          basetemp = self._given_basetemp
          ensure_reset_dir(basetemp)
          basetemp = basetemp.resolve()
      else:
          from_env = os.environ.get("PYTEST_DEBUG_TEMPROOT")
          temproot = Path(from_env or tempfile.gettempdir()).resolve()
          user = get_user() or "unknown"
          # use a sub-directory in the temproot to speed-up
          # make_numbered_dir() call
          rootdir = temproot.joinpath("pytest-of-{}".format(user))
          rootdir.mkdir(exist_ok=True)
          basetemp = make_numbered_dir_with_cleanup(
              prefix="pytest-",
              root=rootdir,
              keep=3,
              lock_timeout=LOCK_TIMEOUT,
          )
      assert basetemp is not None, basetemp
      self._basetemp = t = basetemp
      self._trace("new basetemp", t)
      return t
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import re
  import tempfile
  import warnings
  import attr
  import py
  import six
  import pytest
  from .pathlib import ensure_reset_dir
  from .pathlib import LOCK_TIMEOUT
  from .pathlib import make_numbered_dir
  from .pathlib import make_numbered_dir_with_cleanup
  from .pathlib import Path
  from _pytest.monkeypatch import MonkeyPatch
label_desc: Use image node_id 3 for calling the TempPathFactory obj's underlying member method code with example usage: obj.getbasetemp() and returns: t, self