view tests/test_source.txt @ 53:af4155b0a260 default tip

add --prefix option
author Jeff Hammel <k0scist@gmail.com>
date Tue, 03 Nov 2020 07:59:36 -0800
parents 51b62e96ab51
children
line wrap: on
line source

Test Sources
============

The obligatory imports::

    >>> import os
    >>> from buttercup import source
    >>> cwd = os.getcwd()

Test source resolution::

    >>> pyloader = 'http://k0s.org/hg/pyloader'
    >>> hgsource = source.HgSource(pyloader)
    >>> hgsource.directory() == os.path.join(cwd, 'pyloader')
    True
    >>> toolbox = 'git://github.com/mozilla/toolbox.git'
    >>> gitsource = source.GitSource(toolbox)
    >>> gitsource.directory() == os.path.join(cwd, 'toolbox')
    True

Test source resolution with a dictionary::

    >>> source_dict = {'hg': [pyloader], 'git': [toolbox]}
    >>> sources = source.sources(source_dict, srcdir='/tmp')
    >>> sorted([i.directory() for i in sources])
    ['/tmp/pyloader', '/tmp/toolbox']