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


Python Path.string方法代码示例

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


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

示例1: run

# 需要导入模块: from tests.lib.path import Path [as 别名]
# 或者: from tests.lib.path.Path import string [as 别名]
 def run(self, *args, **kw):
     if self.verbose:
         print('>> running %s %s' % (args, kw))
     cwd = kw.pop('cwd', None)
     run_from = kw.pop('run_from', None)
     assert not cwd or not run_from, "Don't use run_from; it's going away"
     cwd = Path.string(cwd or run_from or self.cwd)
     assert not isinstance(cwd, Path)
     return TestPipResult(super(TestPipEnvironment, self).run(cwd=cwd, *args, **kw), verbose=self.verbose)
开发者ID:Basis,项目名称:pip,代码行数:11,代码来源:__init__.py

示例2: assert_installed

# 需要导入模块: from tests.lib.path import Path [as 别名]
# 或者: from tests.lib.path.Path import string [as 别名]
    def assert_installed(self, pkg_name, editable=True, with_files=[], without_files=[], without_egg_link=False, use_user_site=False):
        e = self.test_env

        if editable:
            pkg_dir = e.venv/ 'src'/ pkg_name.lower()
        else:
            without_egg_link = True
            pkg_dir = e.site_packages / pkg_name

        if use_user_site:
            egg_link_path = e.user_site / pkg_name + '.egg-link'
        else:
            egg_link_path = e.site_packages / pkg_name + '.egg-link'
        if without_egg_link:
            if egg_link_path in self.files_created:
                raise TestFailure('unexpected egg link file created: '\
                                  '%r\n%s' % (egg_link_path, self))
        else:
            if not egg_link_path in self.files_created:
                raise TestFailure('expected egg link file missing: '\
                                  '%r\n%s' % (egg_link_path, self))

            egg_link_file = self.files_created[egg_link_path]

            if not (# FIXME: I don't understand why there's a trailing . here
                    egg_link_file.bytes.endswith('.')
                and egg_link_file.bytes[:-1].strip().endswith(pkg_dir)):
                raise TestFailure(textwrap.dedent(u('''\
                Incorrect egg_link file %r
                Expected ending: %r
                ------- Actual contents -------
                %s
                -------------------------------''' % (
                        egg_link_file,
                        pkg_dir + u('\n.'),
                        egg_link_file.bytes))))

        if use_user_site:
            pth_file = Path.string(e.user_site / 'easy-install.pth')
        else:
            pth_file = Path.string(e.site_packages / 'easy-install.pth')

        if (pth_file in self.files_updated) == without_egg_link:
            raise TestFailure('%r unexpectedly %supdated by install' % (
                pth_file, (not without_egg_link and 'not ' or '')))

        if (pkg_dir in self.files_created) == (curdir in without_files):
            raise TestFailure(textwrap.dedent('''\
            expected package directory %r %sto be created
            actually created:
            %s
            ''') % (
                Path.string(pkg_dir),
                (curdir in without_files and 'not ' or ''),
                sorted(self.files_created.keys())))

        for f in with_files:
            if not (pkg_dir/f).normpath in self.files_created:
                raise TestFailure('Package directory %r missing '\
                                  'expected content %f' % (pkg_dir, f))

        for f in without_files:
            if (pkg_dir/f).normpath in self.files_created:
                raise TestFailure('Package directory %r has '\
                                  'unexpected content %f' % (pkg_dir, f))
开发者ID:Basis,项目名称:pip,代码行数:67,代码来源:__init__.py


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