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


Python server.IndexServer方法代码示例

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


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

示例1: test_links_priority

# 需要导入模块: from setuptools.tests import server [as 别名]
# 或者: from setuptools.tests.server import IndexServer [as 别名]
def test_links_priority(self):
        """
        Download links from the pypi simple index should be used before
        external download links.
        https://bitbucket.org/tarek/distribute/issue/163

        Usecase :
        - someone uploads a package on pypi, a md5 is generated
        - someone manually copies this link (with the md5 in the url) onto an
          external page accessible from the package page.
        - someone reuploads the package (with a different md5)
        - while easy_installing, an MD5 error occurs because the external link
          is used
        -> Setuptools should use the link from pypi, not the external one.
        """
        if sys.platform.startswith('java'):
            # Skip this test on jython because binding to :0 fails
            return

        # start an index server
        server = IndexServer()
        server.start()
        index_url = server.base_url() + 'test_links_priority/simple/'

        # scan a test index
        pi = setuptools.package_index.PackageIndex(index_url)
        requirement = pkg_resources.Requirement.parse('foobar')
        pi.find_packages(requirement)
        server.stop()

        # the distribution has been found
        self.assertTrue('foobar' in pi)
        # we have only one link, because links are compared without md5
        self.assertTrue(len(pi['foobar'])==1)
        # the link should be from the index
        self.assertTrue('correct_md5' in pi['foobar'][0].location) 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:38,代码来源:test_packageindex.py

示例2: test_links_priority

# 需要导入模块: from setuptools.tests import server [as 别名]
# 或者: from setuptools.tests.server import IndexServer [as 别名]
def test_links_priority(self):
        """
        Download links from the pypi simple index should be used before
        external download links.
        https://bitbucket.org/tarek/distribute/issue/163

        Usecase :
        - someone uploads a package on pypi, a md5 is generated
        - someone manually copies this link (with the md5 in the url) onto an
          external page accessible from the package page.
        - someone reuploads the package (with a different md5)
        - while easy_installing, an MD5 error occurs because the external link
          is used
        -> Setuptools should use the link from pypi, not the external one.
        """
        if sys.platform.startswith('java'):
            # Skip this test on jython because binding to :0 fails
            return

        # start an index server
        server = IndexServer()
        server.start()
        index_url = server.base_url() + 'test_links_priority/simple/'

        # scan a test index
        pi = setuptools.package_index.PackageIndex(index_url)
        requirement = pkg_resources.Requirement.parse('foobar')
        pi.find_packages(requirement)
        server.stop()

        # the distribution has been found
        assert 'foobar' in pi
        # we have only one link, because links are compared without md5
        assert len(pi['foobar'])==1
        # the link should be from the index
        assert 'correct_md5' in pi['foobar'][0].location 
开发者ID:ayush1997,项目名称:Sudoku-Solver,代码行数:38,代码来源:test_packageindex.py

示例3: test_links_priority

# 需要导入模块: from setuptools.tests import server [as 别名]
# 或者: from setuptools.tests.server import IndexServer [as 别名]
def test_links_priority(self):
        """
        Download links from the pypi simple index should be used before
        external download links.
        https://bitbucket.org/tarek/distribute/issue/163

        Usecase :
        - someone uploads a package on pypi, a md5 is generated
        - someone manually copies this link (with the md5 in the url) onto an
          external page accessible from the package page.
        - someone reuploads the package (with a different md5)
        - while easy_installing, an MD5 error occurs because the external link
          is used
        -> Setuptools should use the link from pypi, not the external one.
        """
        if sys.platform.startswith('java'):
            # Skip this test on jython because binding to :0 fails
            return

        # start an index server
        server = IndexServer()
        server.start()
        index_url = server.base_url() + 'test_links_priority/simple/'

        # scan a test index
        pi = setuptools.package_index.PackageIndex(index_url)
        requirement = pkg_resources.Requirement.parse('foobar')
        pi.find_packages(requirement)
        server.stop()

        # the distribution has been found
        assert 'foobar' in pi
        # we have only one link, because links are compared without md5
        assert len(pi['foobar']) == 1
        # the link should be from the index
        assert 'correct_md5' in pi['foobar'][0].location 
开发者ID:pypa,项目名称:setuptools,代码行数:38,代码来源:test_packageindex.py


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