예제 #1
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()
예제 #2
0
def test_downloader():
    "It should be possible to download packages from pip repos"

    # Given that I have a finder pointing to our local pypi server
    finder = Finder(**{
        'conf': {
            'pypi_urls': ['http://localhost:8000/simple']
        },
    })

    # And a downloader pointing to a temporary index
    index = Index(FIXTURE('tmpindex'))
    downloader = Downloader(**{'index': index})

    # When I find the link
    link = finder.handle('tests', {'requirement': 'gherkin (== 0.1.0)'})

    # And When I try to retrieve a package from it
    downloader.handle('main', link)

    # Then I see that the package was downloaded correctly to the storage
    index.get('gherkin==0.1.0').should_not.be.empty

    # And I cleanup 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_downloader():
    "It should be possible to download packages from pip repos"

    # Given the following downloader component
    sources = [PipSource(urls=['http://localhost:8000/simple'])]
    index = Index(FIXTURE('tmpindex'))
    downloader = DownloadManager(sources=sources, index=index)

    # When I try to retrieve a package from it
    package = downloader.retrieve('gherkin==0.1.0', 'main')

    # Then I see that the package was downloaded correctly to the storage
    index.get('gherkin==0.1.0').should_not.be.empty

    # And I cleanup the mess
    index.delete()
예제 #5
0
def test_downloader():
    "It should be possible to download packages from pip repos"

    # Given the following downloader component
    sources = [PipSource(urls=['http://localhost:8000/simple'])]
    index = Index(FIXTURE('tmpindex'))
    downloader = DownloadManager(sources=sources, index=index)

    # When I try to retrieve a package from it
    package = downloader.retrieve('gherkin==0.1.0', 'main')

    # Then I see that the package was downloaded correctly to the storage
    index.get('gherkin==0.1.0').should_not.be.empty

    # And I cleanup the mess
    index.delete()
예제 #6
0
def test_index_from_data():
    "It should be possible to index data from memory"

    # Given the following index
    index = Index(FIXTURE('index'))

    # When I index a file
    data = open(FIXTURE('storage1/gherkin-0.1.0.tar.gz'), 'rb').read()
    index.from_data(path='gherkin-0.1.0.tar.gz', data=data)

    # Then I see it inside of the index
    index.get('gherkin==0.1.0').should.equal(
        FIXTURE('index/gherkin-0.1.0.tar.gz'), )

    # And I clean the mess
    index.delete()
예제 #7
0
def test_index_from_data():
    "It should be possible to index data from memory"

    # Given the following index
    index = Index(FIXTURE('index'))

    # When I index a file
    data = open(FIXTURE('storage1/gherkin-0.1.0.tar.gz'), 'rb').read()
    index.from_data(path='gherkin-0.1.0.tar.gz', data=data)

    # Then I see it inside of the index
    index.get('gherkin==0.1.0').should.equal(
        FIXTURE('index/gherkin-0.1.0.tar.gz'),
    )

    # And I clean the mess
    index.delete()
예제 #8
0
def test_index_from_file():
    "It should be possible to index packages from files"

    # Given the following index
    index = Index(FIXTURE('index'))

    # When I index a file
    index.from_file(FIXTURE('storage1/gherkin-0.1.0.tar.gz'))

    # Then I see it inside of the index
    index.get('gherkin==0.1.0;gz').should.equal(
        FIXTURE('index/gherkin-0.1.0.tar.gz'), )

    # And that there's no wheel available yet
    index.get.when.called_with('gherkin==0.1.0;whl').should.throw(
        PackageNotFound, )

    # And I clean the mess
    index.delete()
예제 #9
0
def test_index_from_file():
    "It should be possible to index packages from files"

    # Given the following index
    index = Index(FIXTURE('index'))

    # When I index a file
    index.from_file(FIXTURE('storage1/gherkin-0.1.0.tar.gz'))

    # Then I see it inside of the index
    index.get('gherkin==0.1.0;gz').should.equal(
        FIXTURE('index/gherkin-0.1.0.tar.gz'),
    )

    # And that there's no wheel available yet
    index.get.when.called_with('gherkin==0.1.0;whl').should.throw(
        PackageNotFound,
    )

    # And I clean the mess
    index.delete()
예제 #10
0
파일: test_main.py 프로젝트: qrees/curdling
def test_downloader():
    "It should be possible to download packages from pip repos"

    # Given that I have a finder pointing to our local pypi server
    finder = Finder(**{"conf": {"pypi_urls": ["http://localhost:8000/simple"]}})

    # And a downloader pointing to a temporary index
    index = Index(FIXTURE("tmpindex"))
    downloader = Downloader(**{"index": index})

    # When I find the link
    link = finder.handle("tests", {"requirement": "gherkin (== 0.1.0)"})

    # And When I try to retrieve a package from it
    downloader.handle("main", link)

    # Then I see that the package was downloaded correctly to the storage
    index.get("gherkin==0.1.0").should_not.be.empty

    # And I cleanup the mess
    index.delete()
예제 #11
0
파일: test_main.py 프로젝트: qrees/curdling
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 handle the installer with a requirement
    installer.queue("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()
예제 #12
0
def test_downloader():
    "It should be possible to download packages from pip repos"

    # Given that I have a finder pointing to our local pypi server
    finder = Finder(**{
        'conf': {'pypi_urls': ['http://localhost:8000/simple']},
    })

    # And a downloader pointing to a temporary index
    index = Index(FIXTURE('tmpindex'))
    downloader = Downloader(**{'index': index})

    # When I find the link
    link = finder.handle('tests', {'requirement': 'gherkin (== 0.1.0)'})

    # And When I try to retrieve a package from it
    downloader.handle('main', link)

    # Then I see that the package was downloaded correctly to the storage
    index.get('gherkin==0.1.0').should_not.be.empty

    # And I cleanup the mess
    index.delete()