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


Python Index.storage方法代码示例

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


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

示例1: test_install_feed_when_theres_a_wheel_cached

# 需要导入模块: from curdling.index import Index [as 别名]
# 或者: from curdling.index.Index import storage [as 别名]
def test_install_feed_when_theres_a_wheel_cached():
    "Install#feed() Should route the requirements that already have a wheel to the dependencer"

    # Given that I have a loaded local cache
    index = Index('')
    index.storage = {'gherkin': {'0.1.0': ['storage1/gherkin-0.1.0-py27-none-any.whl']}}

    # And that I have an environment associated with that local cache
    env = Install(conf={'index': index})
    env.pipeline()
    env.downloader.queue = Mock()
    env.dependencer.queue = Mock()
    env.curdler.queue = Mock()

    # When I request an installation of a package
    env.feed('tests', requirement='gherkin==0.1.0')

    # # Then I see that, since the package was not installed, the locall cache
    # # was queried and returned the right entry
    # env.check_installed.assert_called_once_with('gherkin==0.1.0')

    # And I see that the install queue was populated
    env.dependencer.queue.assert_called_once_with(
        'tests',
        requirement='gherkin==0.1.0',
        wheel='storage1/gherkin-0.1.0-py27-none-any.whl',
    )

    # And that the download queue was not touched
    env.downloader.queue.called.should.be.false
开发者ID:madjar,项目名称:curdling,代码行数:32,代码来源:test_command_install.py

示例2: test_request_install_cached_wheels

# 需要导入模块: from curdling.index import Index [as 别名]
# 或者: from curdling.index.Index import storage [as 别名]
def test_request_install_cached_wheels():
    "Request the installation of a cached package"

    # Given that I have a loaded local cache
    index = Index('')
    index.storage = {'gherkin': {'0.1.0': ['storage1/gherkin-0.1.0-py27-none-any.whl']}}

    # And that I have an environment associated with that local cache
    env = Env(conf={'index': index})
    env.check_installed = Mock(return_value=False)
    env.services['download'] = Mock()
    env.services['install'] = Mock()

    # When I request an installation of a package
    env.request_install('gherkin==0.1.0').should.be.false

    # Then I see that, since the package was not installed, the locall cache
    # was queried and returned the right entry
    env.check_installed.assert_called_once_with('gherkin==0.1.0')

    # And I see that the install queue was populated
    env.services['install'].queue.assert_called_once_with(
        'gherkin==0.1.0', 'main', path='storage1/gherkin-0.1.0-py27-none-any.whl')

    # And that the download queue was not touched
    env.services['download'].queue.called.should.be.false
开发者ID:pombredanne,项目名称:curdling,代码行数:28,代码来源:test_main.py

示例3: test_pipeline_downloader_tarzip_curdler

# 需要导入模块: from curdling.index import Index [as 别名]
# 或者: from curdling.index.Index import storage [as 别名]
def test_pipeline_downloader_tarzip_curdler():
    "Install#pipeline() should route all the tar/zip files to the curdler"

    # Given that I have the install command
    index = Index('')
    index.storage = {}
    install = Install(conf={'index': index})

    # And I mock the curdler service end-point and start all the services
    install.curdler.queue = Mock(__name__=str('queue'))
    install.pipeline()

    # Feed the installer with the requirement
    install.finder.queue = Mock()
    install.feed('tests', requirement='curdling')

    # When I fire the download.finished() signal with proper data
    install.downloader.emit('finished',
        'downloader',
        requirement='curdling',
        tarball='curdling-0.1.tar.gz')

    # Than I see that the curdler received a request
    install.curdler.queue.assert_called_once_with(
        'downloader',
        requirement='curdling',
        tarball='curdling-0.1.tar.gz')
开发者ID:madjar,项目名称:curdling,代码行数:29,代码来源:test_command_install.py

示例4: test_pipeline_curdler_wheel_dependencer

# 需要导入模块: from curdling.index import Index [as 别名]
# 或者: from curdling.index.Index import storage [as 别名]
def test_pipeline_curdler_wheel_dependencer():
    "Install#pipeline() should route all the wheel files from the curdler to the dependencer"

    # Given that I have the install command
    index = Index('')
    index.storage = {}
    install = Install(conf={'index': index})

    # And I mock the curdler service end-point and start all the services
    install.dependencer.queue = Mock(__name__=str('queue'))
    install.pipeline()

    # Feed the installer with the requirement
    install.finder.queue = Mock()
    install.feed('tests', requirement='curdling')

    # When I fire the curdler.finished() signal with proper data
    install.curdler.emit('finished',
        'curdler',
        requirement='curdling',
        wheel='curdling-0.1.0-py27-none-any.whl')

    # Than I see that the dependencer received a request
    install.dependencer.queue.assert_called_once_with(
        'curdler',
        requirement='curdling',
        wheel='curdling-0.1.0-py27-none-any.whl')
开发者ID:madjar,项目名称:curdling,代码行数:29,代码来源:test_command_install.py

示例5: test_index_get_corner_case_pkg_name

# 需要导入模块: from curdling.index import Index [as 别名]
# 或者: from curdling.index.Index import storage [as 别名]
def test_index_get_corner_case_pkg_name():
    "It should be possible to search for packages that contain `_` in their name"

    # Given that I have an index loaded with a couple package references
    index = Index("")
    index.storage = {"python-gherkin": {"0.1.0": ["python_gherkin-0.1.0.tar.gz"]}}

    index.get("python-gherkin==0.1.0;~whl").should.equal("python_gherkin-0.1.0.tar.gz")
开发者ID:MicahChambers,项目名称:curdling,代码行数:10,代码来源:test_index.py

示例6: test_index_get

# 需要导入模块: from curdling.index import Index [as 别名]
# 或者: from curdling.index.Index import storage [as 别名]
def test_index_get():
    "It should be possible to search for packages using different criterias"

    # Given that I have an index loaded with a couple package references
    index = Index("")
    index.storage = {
        "gherkin": {
            "0.2.0": ["gherkin-0.2.0.tar.gz"],
            "0.1.5": ["gherkin-0.2.0.tar.gz"],
            "0.1.1": ["gherkin-0.1.1.tar.gz"],
            "0.1.0": ["gherkin-0.1.0.tar.gz", "gherkin-0.1.0-py27-none-any.whl"],
        }
    }

    # Let's do some random assertions

    # No version: Always brings the newest
    index.get("gherkin").should.equal("gherkin-0.2.0.tar.gz")

    # With a range of versions: Always brings the newest
    index.get("gherkin (> 0.1.0)").should.equal("gherkin-0.2.0.tar.gz")

    # With a handful of version specs: Find the matching version and prefer whl
    index.get("gherkin (>= 0.1.0, < 0.1.5, != 0.1.1)").should.equal("gherkin-0.1.0-py27-none-any.whl")

    # With version: Always prefers the wheel
    index.get("gherkin (== 0.1.0, <= 0.2.0)").should.equal("gherkin-0.1.0-py27-none-any.whl")

    # With version and format: Prefers anything but `whl'
    index.get("gherkin (== 0.1.0);~whl").should.equal("gherkin-0.1.0.tar.gz")

    # With version range and no format: Finds the highest version with the :)
    index.get.when.called_with("gherkin (== 0.1.1);whl").should.throw(
        PackageNotFound, ("The index does not have the requested package: " "gherkin (0.1.1) (whl)")
    )

    # With version and a format that is not available: Blows up! :)
    index.get.when.called_with("gherkin (== 0.1.1);whl").should.throw(
        PackageNotFound, ("The index does not have the requested package: " "gherkin (0.1.1) (whl)")
    )

    # With a version we simply don't have: Blows up! :)
    index.get.when.called_with("gherkin (== 0.2.1)").should.throw(
        PackageNotFound, ("The index does not have the requested package: " "gherkin (0.2.1)")
    )

    # With a package we simply don't have: Blows up! :)
    index.get.when.called_with("nonexisting (== 0.2.1)").should.throw(
        PackageNotFound, ("The index does not have the requested package: " "nonexisting (0.2.1)")
    )

    # Case insensitive
    index.get("Gherkin").should.equal("gherkin-0.2.0.tar.gz")
开发者ID:MicahChambers,项目名称:curdling,代码行数:55,代码来源:test_index.py

示例7: test_index_get_corner_case_pkg_name

# 需要导入模块: from curdling.index import Index [as 别名]
# 或者: from curdling.index.Index import storage [as 别名]
def test_index_get_corner_case_pkg_name():
    "It should be possible to search for packages that contain `_` in their name"

    # Given that I have an index loaded with a couple package references
    index = Index('')
    index.storage = {
        'python-gherkin': {
            '0.1.0': [
                'python_gherkin-0.1.0.tar.gz',
            ]
        }
     }

    index.get('python-gherkin==0.1.0;~whl').should.equal('python_gherkin-0.1.0.tar.gz')
开发者ID:douglas,项目名称:curdling,代码行数:16,代码来源:test_index.py

示例8: test_pipeline_finder_found_downloader

# 需要导入模块: from curdling.index import Index [as 别名]
# 或者: from curdling.index.Index import storage [as 别名]
def test_pipeline_finder_found_downloader():
    "Install#pipeline() should route the finder output to the downloader"

    # Given that I have the install command
    index = Index('')
    index.storage = {}
    install = Install(conf={'index': index})

    # And I mock the downloader service end-point
    install.finder.queue = Mock(__name__=str('queue'))
    install.downloader.queue = Mock(__name__=str('queue'))
    install.pipeline()

    # Feed the installer with the requirement
    install.finder.queue = Mock()
    install.feed('tests', requirement='package')
    install.feed('tests', requirement='package (0.0.1)')

    # When I fire the finder.finished() signal with proper data
    install.finder.emit('finished',
        'finder',
        requirement='package',
        url='http://srv.com/package.tar.gz',
        locator_url='http://usr:[email protected]/simple',
    )

    # And manually add the first package to the `processing_packages` set,
    # because we mock `queue`, the component that actually does that for us.
    install.downloader.processing_packages.add('package.tar.gz')

    # And When I fire another finished signal with a different requirement but
    # the same url
    install.finder.emit('finished',
        'finder',
        requirement='package (0.0.1)',
        url='http://another.srv.com/package.tar.gz',
        locator_url='http://srv.com/simple',
    )

    # Then I see that the downloader received a single request. The second one
    # was duplicated
    install.downloader.queue.assert_called_once_with(
        'finder',
        requirement='package',
        url='http://srv.com/package.tar.gz',
        locator_url='http://usr:[email protected]/simple',
    )
开发者ID:madjar,项目名称:curdling,代码行数:49,代码来源:test_command_install.py

示例9: test_feed_filter_blacklisted_packages

# 需要导入模块: from curdling.index import Index [as 别名]
# 或者: from curdling.index.Index import storage [as 别名]
def test_feed_filter_blacklisted_packages():
    "Install#feed() Should skip blacklisted package names"

    # Given that I have the install command
    index = Index('')
    index.storage = {}
    install = Install(conf={'index': index})

    # And I mock the finder service end-point
    install.finder.queue = Mock()
    install.pipeline()

    # When I feed the installer with the requirement
    install.feed('tests', requirement='setuptools')

    # Then I see it was just skipped
    install.finder.queue.called.should.be.false
开发者ID:madjar,项目名称:curdling,代码行数:19,代码来源:test_command_install.py

示例10: test_feed_requirement_finder

# 需要导入模块: from curdling.index import Index [as 别名]
# 或者: from curdling.index.Index import storage [as 别名]
def test_feed_requirement_finder():
    "Install#feed() should route all queued requirements to the finder"

    # Given that I have the install command
    index = Index('')
    index.storage = {}
    install = Install(conf={'index': index})
    install.pipeline()

    # And I mock some service end-points
    install.finder.queue = Mock()

    # When I request the installation of a new requirement
    install.feed('tests', requirement='curdling')

    # Then I see the finder received a request
    install.finder.queue.assert_called_once_with(
        'tests', requirement='curdling')
开发者ID:madjar,项目名称:curdling,代码行数:20,代码来源:test_command_install.py

示例11: test_pipeline_dependencer_queue

# 需要导入模块: from curdling.index import Index [as 别名]
# 或者: from curdling.index.Index import storage [as 别名]
def test_pipeline_dependencer_queue():
    "Install#pipeline() should route all the requirements from the dependencer to Install#feed()"

    # Given that I have the install command
    index = Index('')
    index.storage = {}
    install = Install(conf={'index': index})

    # And I mock the curdler service end-point and start all the services
    install.feed = Mock(__name__=str('feed'))
    install.pipeline()

    # When I fire the download.finished() signal with proper data
    install.dependencer.emit('dependency_found', 'dependencer', requirement='curdling (0.3.0)')

    # Than I see that the curdler received a request
    install.feed.assert_called_once_with(
        'dependencer', requirement='curdling (0.3.0)')
开发者ID:madjar,项目名称:curdling,代码行数:20,代码来源:test_command_install.py

示例12: test_pipeline_update_mapping_errors

# 需要导入模块: from curdling.index import Index [as 别名]
# 或者: from curdling.index.Index import storage [as 别名]
def test_pipeline_update_mapping_errors():
    "Install#pipeline() Should update Install#mapping#errors whenever an error occurs"

    # Given that I have the install command
    index = Index('')
    index.storage = {}
    install = Install(conf={'index': index})
    install.pipeline()

    install.finder.handle = Mock(side_effect=Exception('P0wned!'))

    # When I feed the installer with a requirement
    install.feed('tests', requirement='pkg (0.1)')
    install.finder.queue(None)
    install.finder._worker()

    install.mapping.errors.should.have.length_of(1)
    str(install.mapping.errors['pkg'][0]['exception']).should.equal('P0wned!')
开发者ID:madjar,项目名称:curdling,代码行数:20,代码来源:test_command_install.py

示例13: test_pipeline_update_mapping_stats

# 需要导入模块: from curdling.index import Index [as 别名]
# 或者: from curdling.index.Index import storage [as 别名]
def test_pipeline_update_mapping_stats():
    "Install#pipeline() Should update the Install#mapping#stats"

    # Given that I have the install command
    index = Index('')
    index.storage = {}
    install = Install(conf={'index': index})
    install.pipeline()

    install.finder.handle = Mock(return_value={
        'requirement': 'pkg',
        'url': 'pkg.tar.gz',
    })

    # When I feed the installer with a requirement
    install.feed('tests', requirement='pkg')
    install.finder.queue(None)
    install.finder._worker()

    install.mapping.count('finder').should.equal(1)
开发者ID:madjar,项目名称:curdling,代码行数:22,代码来源:test_command_install.py

示例14: test_feed_link_download

# 需要导入模块: from curdling.index import Index [as 别名]
# 或者: from curdling.index.Index import storage [as 别名]
def test_feed_link_download():
    "Install#feed() should route all queued links to the downloader"

    # Given that I have the install command
    index = Index('')
    index.storage = {}
    install = Install(conf={'index': index})
    install.pipeline()

    # And I mock some service end-points
    install.downloader.queue = Mock()

    # When I request the installation of a new requirement
    install.feed('tests', requirement='http://srv/pkgs/curdling-0.1.tar.gz')

    # I see that the downloader received a request
    install.downloader.queue.assert_called_once_with(
        'tests',
        requirement='http://srv/pkgs/curdling-0.1.tar.gz',
        url='http://srv/pkgs/curdling-0.1.tar.gz')
开发者ID:madjar,项目名称:curdling,代码行数:22,代码来源:test_command_install.py

示例15: test_feed_filter_compatible_requirements

# 需要导入模块: from curdling.index import Index [as 别名]
# 或者: from curdling.index.Index import storage [as 别名]
def test_feed_filter_compatible_requirements():
    "Install#feed() Should skip requirements that already have compatible matches in the mapping"

    # Given that I have the install command
    index = Index('')
    index.storage = {}
    install = Install(conf={'index': index})

    # And I mock the finder service end-point
    install.finder.queue = Mock()
    install.pipeline()

    # When I feed the installer with a requirement *without dependencies*
    install.feed('tests', requirement='package (1.0)')

    # And I feed the installer with another requirement for the same
    # package above, requested by `something-else`
    install.feed('tests', requirement='package (3.0)', dependency_of='something-else')

    # Then I see that the requirement without any dependencies
    # (primary requirement) is the chosen one
    install.finder.queue.assert_called_once_with('tests', requirement='package (1.0)')
    install.mapping.requirements.should.equal(set(['package (1.0)']))
开发者ID:madjar,项目名称:curdling,代码行数:25,代码来源:test_command_install.py


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