Mercurial > hg > fetch
view tests/doctest.txt @ 28:5ecb6507931b
fix vcs fetchers to almost follow a pattern
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 14 Nov 2011 22:12:49 -0800 |
parents | 63ff1b00ec05 |
children | 1c963875e6cd |
line wrap: on
line source
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(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)