Mercurial > hg > fetch
changeset 22:63ff1b00ec05
first passing test
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 09 Nov 2011 20:11:05 -0800 |
parents | 0706968f01bb |
children | 12ad9ab11860 |
files | tests/doctest.txt tests/sample1.txt |
diffstat | 2 files changed, 21 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/doctest.txt Wed Nov 09 19:59:04 2011 -0800 +++ b/tests/doctest.txt Wed Nov 09 20:11:05 2011 -0800 @@ -1,11 +1,29 @@ Test fetch -================ +========== The obligatory imports:: >>> import fetch + >>> import os + >>> import shutil + >>> import tempfile + +Create a staging directory:: + + >>> stage = tempfile.mkdtemp() Create a Fetch object:: - >>> f = fetch.Fetch(strict=True) + >>> f = fetch.Fetch(relative_to=stage, strict=True) + +Call Fetch directly:: + >>> def url(*args): + ... return 'file://' + os.path.join(*([here] + list(args))) + >>> f(url=url('sample1.txt'), destination=stage, type='file') + >>> file(os.path.join(stage, 'sample1.txt')).read().strip() + 'sample1' + +Cleanup:: + + >>> shutil.rmtree(stage)