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


Python PythonInterpreterCache._setup_cached方法代码示例

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


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

示例1: _setup_test

# 需要导入模块: from pants.backend.python.interpreter_cache import PythonInterpreterCache [as 别名]
# 或者: from pants.backend.python.interpreter_cache.PythonInterpreterCache import _setup_cached [as 别名]
  def _setup_test(self, constraints=None):
    mock_setup = mock.MagicMock().return_value
    type(mock_setup).interpreter_constraints = mock.PropertyMock(return_value=constraints)

    with temporary_dir() as path:
      mock_setup.interpreter_cache_dir = path
      cache = PythonInterpreterCache(mock_setup, mock.MagicMock())

      def set_interpreters(_):
        cache._interpreters.add(self._interpreter)

      cache._setup_cached = mock.Mock(side_effect=set_interpreters)
      cache._setup_paths = mock.Mock()
      yield cache, path
开发者ID:grimreaper,项目名称:pants,代码行数:16,代码来源:test_interpreter_cache.py

示例2: _setup_test

# 需要导入模块: from pants.backend.python.interpreter_cache import PythonInterpreterCache [as 别名]
# 或者: from pants.backend.python.interpreter_cache.PythonInterpreterCache import _setup_cached [as 别名]
  def _setup_test(self, constraints=None, mock_setup_paths_interpreters=None):
    mock_setup = mock.MagicMock().return_value
    type(mock_setup).interpreter_constraints = mock.PropertyMock(return_value=constraints)

    with temporary_dir() as path:
      mock_setup.interpreter_cache_dir = path
      cache = PythonInterpreterCache(mock_setup, mock.MagicMock())
      cache._setup_cached = mock.Mock(return_value=[self._interpreter])
      if mock_setup_paths_interpreters:
        cache._setup_paths = mock.Mock(return_value=[PythonInterpreter.from_binary(mock_setup_paths_interpreters[0]),
                                                     PythonInterpreter.from_binary(mock_setup_paths_interpreters[1])])
      else:
        cache._setup_paths = mock.Mock(return_value=[])
      yield cache, path
开发者ID:benjyw,项目名称:pants,代码行数:16,代码来源:test_interpreter_cache.py

示例3: _setup_test

# 需要导入模块: from pants.backend.python.interpreter_cache import PythonInterpreterCache [as 别名]
# 或者: from pants.backend.python.interpreter_cache.PythonInterpreterCache import _setup_cached [as 别名]
  def _setup_test(self, interpreter_requirement=None):
    mock_setup = mock.MagicMock().return_value

    # Explicitly set a repo-wide requirement that excludes our one interpreter.
    type(mock_setup).interpreter_requirement = mock.PropertyMock(
      return_value=interpreter_requirement)

    with temporary_dir() as path:
      mock_setup.interpreter_cache_dir = path
      cache = PythonInterpreterCache(mock_setup, mock.MagicMock())

      def set_interpreters(_):
        cache._interpreters.add(self._interpreter)

      cache._setup_cached = mock.Mock(side_effect=set_interpreters)
      cache._setup_paths = mock.Mock()
      yield cache, path
开发者ID:Gointer,项目名称:pants,代码行数:19,代码来源:test_interpreter_cache.py

示例4: test_cache_setup_with_no_filters_uses_repo_default_excluded

# 需要导入模块: from pants.backend.python.interpreter_cache import PythonInterpreterCache [as 别名]
# 或者: from pants.backend.python.interpreter_cache.PythonInterpreterCache import _setup_cached [as 别名]
  def test_cache_setup_with_no_filters_uses_repo_default_excluded(self, MockSetup):
    interpreter = PythonInterpreter.get()

    mock_setup = MockSetup.return_value
    type(mock_setup).interpreter_requirement = mock.PropertyMock(return_value=None)

    with temporary_dir() as path:
      mock_setup.scratch_dir.return_value = path

      cache = PythonInterpreterCache(mock.MagicMock())

      def set_interpreters(_):
        cache._interpreters.add(interpreter)

      cache._setup_cached = mock.Mock(side_effect=set_interpreters)

      self.assertEqual(cache.setup(), [interpreter])
开发者ID:Yasumoto,项目名称:pants,代码行数:19,代码来源:test_interpreter_cache.py

示例5: _do_test

# 需要导入模块: from pants.backend.python.interpreter_cache import PythonInterpreterCache [as 别名]
# 或者: from pants.backend.python.interpreter_cache.PythonInterpreterCache import _setup_cached [as 别名]
  def _do_test(self, interpreter_requirement, filters, expected):
    mock_setup = mock.MagicMock().return_value

    # Explicitly set a repo-wide requirement that excludes our one interpreter.
    type(mock_setup).interpreter_requirement = mock.PropertyMock(
      return_value=interpreter_requirement)

    with temporary_dir() as path:
      mock_setup.scratch_dir = path
      cache = PythonInterpreterCache(mock_setup, mock.MagicMock())

      def set_interpreters(_):
        cache._interpreters.add(self._interpreter)

      cache._setup_cached = mock.Mock(side_effect=set_interpreters)
      cache._setup_paths = mock.Mock()

      self.assertEqual(cache.setup(filters=filters), expected)
开发者ID:WamBamBoozle,项目名称:pants,代码行数:20,代码来源:test_interpreter_cache.py

示例6: test_cache_setup_with_filter_overrides_repo_default

# 需要导入模块: from pants.backend.python.interpreter_cache import PythonInterpreterCache [as 别名]
# 或者: from pants.backend.python.interpreter_cache.PythonInterpreterCache import _setup_cached [as 别名]
  def test_cache_setup_with_filter_overrides_repo_default(self, MockSetup):
    interpreter = PythonInterpreter.get()

    mock_setup = MockSetup.return_value
    # Explicitly set a repo-wide requirement that excludes our one interpreter
    type(mock_setup).interpreter_requirement = mock.PropertyMock(
        return_value=self._make_bad_requirement(interpreter.identity.requirement))

    with temporary_dir() as path:
      mock_setup.scratch_dir.return_value = path

      cache = PythonInterpreterCache(mock.MagicMock())

      def set_interpreters(_):
        cache._interpreters.add(interpreter)

      cache._setup_cached = mock.Mock(side_effect=set_interpreters)

      self.assertEqual(cache.setup(filters=(str(interpreter.identity.requirement),)), [interpreter])
开发者ID:Yasumoto,项目名称:pants,代码行数:21,代码来源:test_interpreter_cache.py


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