original_docstring:  Provide tmp dirs for project/envs and update CWD/NPMENV_DIR respectively
  
      NOTE Apply to all tests to avoid accidental filesystem changes
      WARN Even if some methods don't touch filesystem now, they may in future!
  
      
docstring: Provide tmp dirs for project/envs and update CWD/NPMENV_DIR respectively
  NOTE Apply to all tests to avoid accidental filesystem changes
  WARN Even if some methods don't touch filesystem now, they may in future!
docstring_tokens: Provide tmp dirs for project / envs and update CWD / NPMENV_DIR respectively NOTE Apply to all tests to avoid accidental filesystem changes WARN Even if some methods don ' t touch filesystem now they may in future!
code: def sandbox(request, tmpdir_factory, monkeypatch):
      """ Provide tmp dirs for project/envs and update CWD/NPMENV_DIR respectively
  
      NOTE Apply to all tests to avoid accidental filesystem changes
      WARN Even if some methods don't touch filesystem now, they may in future!
  
      """
  
      # Do nothing if test marked with 'sandbox_disable'
      # NOTE Only use for tests that do not touch filesystem and need to check real paths
      if 'sandbox_disable' in request.keywords:
          return
  
      # Create tmp project
      proj_dir = tmpdir_factory.mktemp('npmenv_test_project')
      proj_dir = Path(str(proj_dir))
  
      # Create tmp envs location
      envs = tmpdir_factory.mktemp('npmenv_test_envs')
      envs = Path(str(envs))
  
      # Override NPMENV_DIR and change into project dir (monkeypatch undoes these later)
      monkeypatch.setattr(npmenv, 'NPMENV_DIR', envs)
      monkeypatch.chdir(str(proj_dir))
  
      # Provide paths
      # NOTE pytest will handle cleanup
      # WARN Can't mix above `return` with a `yield` here, so beware if doing custom cleanup
      env_dir = envs / npmenv._get_env_id(proj_dir)
      return {
          'envs': envs,
          'proj_dir': proj_dir,
          'proj_package': proj_dir / 'package.json',
          'proj_lock': proj_dir / 'package-lock.json',
          'env_dir': env_dir,
          'env_package': env_dir / 'package.json',
          'env_lock': env_dir / 'package-lock.json',
          'env_module': env_dir / 'node_modules/to-no-case',
      }
code_tokens: def sandbox ( request , tmpdir_factory , monkeypatch ) : if 'sandbox_disable' in request . keywords : return proj_dir = tmpdir_factory . mktemp ( 'npmenv_test_project' ) proj_dir = Path ( str ( proj_dir ) ) envs = tmpdir_factory . mktemp ( 'npmenv_test_envs' ) envs = Path ( str ( envs ) ) monkeypatch . setattr ( npmenv , 'NPMENV_DIR' , envs ) monkeypatch . chdir ( str ( proj_dir ) ) env_dir = envs / npmenv . _get_env_id ( proj_dir ) return { 'envs' : envs , 'proj_dir' : proj_dir , 'proj_package' : proj_dir / 'package.json' , 'proj_lock' : proj_dir / 'package-lock.json' , 'env_dir' : env_dir , 'env_package' : env_dir / 'package.json' , 'env_lock' : env_dir / 'package-lock.json' , 'env_module' : env_dir / 'node_modules/to-no-case' , }
short_docstring: Provide tmp dirs for project/envs and update CWD/NPMENV_DIR respectively
  NOTE Apply to all tests to avoid accidental filesystem changes
  WARN Even if some methods don't touch filesystem now, they may in future!
short_docstring_tokens: Provide tmp dirs for project / envs and update CWD / NPMENV_DIR respectively NOTE Apply to all tests to avoid accidental filesystem changes WARN Even if some methods don ' t touch filesystem now they may in future!
comment: """ Provide tmp dirs for project/envs and update CWD/NPMENV_DIR respectively
  
      NOTE Apply to all tests to avoid accidental filesystem changes
      WARN Even if some methods don't touch filesystem now, they may in future!
  
      """$SEP$# Do nothing if test marked with 'sandbox_disable'$SEP$# NOTE Only use for tests that do not touch filesystem and need to check real paths$SEP$# Create tmp project$SEP$# Create tmp envs location$SEP$# Override NPMENV_DIR and change into project dir (monkeypatch undoes these later)$SEP$# Provide paths$SEP$# NOTE pytest will handle cleanup$SEP$# WARN Can't mix above `return` with a `yield` here, so beware if doing custom cleanup