# HG changeset patch # User Jeff Hammel # Date 1320898265 28800 # Node ID 63ff1b00ec05a13d46f95381bba304c639cee5aa # Parent 0706968f01bbfd73bb6cd516f9b49495962531ff first passing test diff -r 0706968f01bb -r 63ff1b00ec05 tests/doctest.txt --- 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) diff -r 0706968f01bb -r 63ff1b00ec05 tests/sample1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/sample1.txt Wed Nov 09 20:11:05 2011 -0800 @@ -0,0 +1,1 @@ +sample1