class_docstr: Command to run unit tests after in-place build
class_docstr_tok: ["Command","to","run","unit","tests","after","in-place","build"]
code: def project_on_sys_path(self, include_dists=[]):
      with_2to3 = not six.PY2 and getattr(
          self.distribution, "use_2to3", False
      )
  
      if with_2to3:
          # If we run 2to3 we can not do this inplace:
  
          # Ensure metadata is up-to-date
          self.reinitialize_command("build_py", inplace=0)
          self.run_command("build_py")
          bpy_cmd = self.get_finalized_command("build_py")
          build_path = normalize_path(bpy_cmd.build_lib)
  
          # Build extensions
          self.reinitialize_command("egg_info", egg_base=build_path)
          self.run_command("egg_info")
  
          self.reinitialize_command("build_ext", inplace=0)
          self.run_command("build_ext")
      else:
          # Without 2to3 inplace works fine:
          self.run_command("egg_info")
  
          # Build extensions in-place
          self.reinitialize_command("build_ext", inplace=1)
          self.run_command("build_ext")
  
      ei_cmd = self.get_finalized_command("egg_info")
  
      old_path = sys.path[:]
      old_modules = sys.modules.copy()
  
      try:
          project_path = normalize_path(ei_cmd.egg_base)
          sys.path.insert(0, project_path)
          working_set.__init__()
          add_activation_listener(lambda dist: dist.activate())
          require("%s==%s" % (ei_cmd.egg_name, ei_cmd.egg_version))
          with self.paths_on_pythonpath([project_path]):
              yield
      finally:
          sys.path[:] = old_path
          sys.modules.clear()
          sys.modules.update(old_modules)
          working_set.__init__()
  
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 setuptools.extern import six
  from setuptools.extern.six.moves import map, filter
  from pkg_resources import resource_listdir, resource_exists, normalize_path, working_set, _namespace_packages, evaluate_marker, add_activation_listener, require, EntryPoint
  from setuptools import Command
  from .build_py import _unique_everseen
label_desc: Use image node_id 6 for calling the test obj's underlying member method code with example usage: obj.project_on_sys_path(include_dists) without return types