当前位置: 首页>>代码示例>>Python>>正文


Python PEX.path方法代码示例

本文整理汇总了Python中pex.pex.PEX.path方法的典型用法代码示例。如果您正苦于以下问题:Python PEX.path方法的具体用法?Python PEX.path怎么用?Python PEX.path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pex.pex.PEX的用法示例。


在下文中一共展示了PEX.path方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: PytestBinary

# 需要导入模块: from pex.pex import PEX [as 别名]
# 或者: from pex.pex.PEX import path [as 别名]
  class PytestBinary(object):
    """A `py.test` PEX binary with an embedded default (empty) `pytest.ini` config file."""

    _COVERAGE_PLUGIN_MODULE_NAME = '__{}__'.format(__name__.replace('.', '_'))

    def __init__(self, interpreter, pex):
      # Here we hack around `coverage.cmdline` nuking the 0th element of `sys.path` (our root pex)
      # by ensuring, the root pex is on the sys.path twice.
      # See: https://github.com/nedbat/coveragepy/issues/715
      pex_path = pex.path()
      pex_info = PexInfo.from_pex(pex_path)
      pex_info.merge_pex_path(pex_path)  # We're now on the sys.path twice.
      PEXBuilder(pex_path, interpreter=interpreter, pex_info=pex_info).freeze()
      self._pex = PEX(pex=pex_path, interpreter=interpreter)
      self._interpreter = interpreter

    @property
    def pex(self):
      """Return the loose-source py.test binary PEX.

      :rtype: :class:`pex.pex.PEX`
      """
      return self._pex

    @property
    def interpreter(self):
      """Return the interpreter used to build this PEX.

      :rtype: :class:`pex.interpreter.PythonInterpreter`
      """
      return self._interpreter

    @property
    def config_path(self):
      """Return the absolute path of the `pytest.ini` config file in this py.test binary.

      :rtype: str
      """
      return os.path.join(self._pex.path(), 'pytest.ini')

    @classmethod
    def coverage_plugin_module(cls):
      """Return the name of the coverage plugin module embedded in this py.test binary.

      :rtype: str
      """
      return cls._COVERAGE_PLUGIN_MODULE_NAME
开发者ID:jsirois,项目名称:pants,代码行数:49,代码来源:pytest_prep.py


注:本文中的pex.pex.PEX.path方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。