class_docstr: Command to run unit tests after in-place build
class_docstr_tok: ["Command","to","run","unit","tests","after","in-place","build"]
docstr: Add the indicated paths to the head of the PYTHONPATH environment
  variable so that subprocesses will also see the packages at
  these paths.
  
  Do this in a context that restores the value on exit.
docstr_tok: ["Add","the","indicated","paths","to","the","head","of","the","PYTHONPATH","environment","variable","so","that","subprocesses","will","also","see","the","packages","at","these","paths",".","Do","this","in","a","context","that","restores","the","value","on","exit","."]
code: def paths_on_pythonpath(paths):
      """
      Add the indicated paths to the head of the PYTHONPATH environment
      variable so that subprocesses will also see the packages at
      these paths.
  
      Do this in a context that restores the value on exit.
      """
      nothing = object()
      orig_pythonpath = os.environ.get("PYTHONPATH", nothing)
      current_pythonpath = os.environ.get("PYTHONPATH", "")
      try:
          prefix = os.pathsep.join(unique_everseen(paths))
          to_join = filter(None, [prefix, current_pythonpath])
          new_path = os.pathsep.join(to_join)
          if new_path:
              os.environ["PYTHONPATH"] = new_path
          yield
      finally:
          if orig_pythonpath is nothing:
              os.environ.pop("PYTHONPATH", None)
          else:
              os.environ["PYTHONPATH"] = orig_pythonpath
  
imports: import os
  import operator
  import sys
  import contextlib
  import itertools
  import unittest
  from distutils.errors import DistutilsError, DistutilsOptionError
  from distutils import log
  from unittest import TestLoader
  from pkg_resources import resource_listdir, resource_exists, normalize_path, working_set, evaluate_marker, add_activation_listener, require
  from .._importlib import metadata
  from setuptools import Command
  from setuptools.extern.more_itertools import unique_everseen
  from setuptools.extern.jaraco.functools import pass_none
label_desc: Use image node_id 7 for calling the test obj's underlying member method code with example usage: obj.paths_on_pythonpath(paths) without return types