예제 #1
0
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
예제 #2
0
def test_retrieve_and_build():
    "Install#retrieve_and_build() "

    # Given that I have an installer with a working index
    index = Index(FIXTURE('tmp'))
    installer = Install(**{
        'conf': {
            'index': index,
            'pypi_urls': ['http://localhost:8000/simple']
        },
    })
    installer.pipeline()

    # And I feed the installer with a requirement
    installer.feed('tests', requirement='gherkin')

    # And start the installer
    installer.start()

    # When I run the retrieve and build loop
    packages = installer.retrieve_and_build()

    # Than I see that the package was retrieved
    packages.should.equal(set(['gherkin']))

    # And I clean the mess
    index.delete()
예제 #3
0
def test_retrieve_and_build():
    "Install#retrieve_and_build() "

    # Given that I have an installer with a working index
    index = Index(FIXTURE('tmp'))
    installer = Install(**{
        'conf': {
            'index': index,
            'pypi_urls': ['http://localhost:8000/simple']
        },
    })
    installer.pipeline()

    # And I feed the installer with a requirement
    installer.feed('tests', requirement='gherkin')

    # And start the installer
    installer.start()

    # When I run the retrieve and build loop
    packages = installer.retrieve_and_build()

    # Than I see that the package was retrieved
    packages.should.equal(set(['gherkin']))

    # And I clean the mess
    index.delete()
예제 #4
0
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
예제 #5
0
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)')
예제 #6
0
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)')