# HG changeset patch # User Jeff Hammel # Date 1306815079 25200 # Node ID a545438386869a1c780225b88392732a7766528b # Parent 88f3d83eb858362053018ff9dff544ea5615be10 add test for source demunging diff -r 88f3d83eb858 -r a54543838686 buttercup/buttercup.py --- a/buttercup/buttercup.py Mon May 30 21:03:45 2011 -0700 +++ b/buttercup/buttercup.py Mon May 30 21:11:19 2011 -0700 @@ -31,3 +31,5 @@ for package in self.PACKAGES ]} sources['git'] = ['git://github.com/mozilla/toolbox.git'] + + diff -r 88f3d83eb858 -r a54543838686 buttercup/checkout.py --- a/buttercup/checkout.py Mon May 30 21:03:45 2011 -0700 +++ b/buttercup/checkout.py Mon May 30 21:11:19 2011 -0700 @@ -12,6 +12,7 @@ import os import sys import subprocess +from buttercup import Buttercup from optparse import OptionParser HG='http://k0s.org/hg' diff -r 88f3d83eb858 -r a54543838686 buttercup/source.py --- a/buttercup/source.py Mon May 30 21:03:45 2011 -0700 +++ b/buttercup/source.py Mon May 30 21:11:19 2011 -0700 @@ -58,7 +58,7 @@ __call__ = update -def VCS_sources(source_dict, **kwargs): +def sources(source_dict, **kwargs): retval = [] for repo_type, sources in source_dict.items(): if repo_type == 'hg': diff -r 88f3d83eb858 -r a54543838686 tests/doctest.txt --- a/tests/doctest.txt Mon May 30 21:03:45 2011 -0700 +++ b/tests/doctest.txt Mon May 30 21:11:19 2011 -0700 @@ -9,9 +9,18 @@ Test source resolution:: - >>> hgsource = source.HgSource('http://k0s.org/hg/pyloader') + >>> pyloader = 'http://k0s.org/hg/pyloader' + >>> hgsource = source.HgSource(pyloader) >>> hgsource.directory() == os.path.join(cwd, 'pyloader') True - >>> gitsource = source.GitSource('git://github.com/mozilla/toolbox.git') + >>> 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']