annotate tests/doctest.txt @ 24:b1f65f3bd1bc

pretend to flesh out git fetcher
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 10 Nov 2011 08:16:48 -0800
parents 63ff1b00ec05
children 1c963875e6cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3497a30190d2 initial commit of fetch, WIP
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 Test fetch
22
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
2 ==========
0
3497a30190d2 initial commit of fetch, WIP
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3
21
0706968f01bb stub testing
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
4 The obligatory imports::
0
3497a30190d2 initial commit of fetch, WIP
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5
3497a30190d2 initial commit of fetch, WIP
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6 >>> import fetch
22
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
7 >>> import os
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
8 >>> import shutil
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
9 >>> import tempfile
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
10
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
11 Create a staging directory::
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
12
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
13 >>> stage = tempfile.mkdtemp()
0
3497a30190d2 initial commit of fetch, WIP
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14
21
0706968f01bb stub testing
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
15 Create a Fetch object::
0
3497a30190d2 initial commit of fetch, WIP
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16
22
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
17 >>> f = fetch.Fetch(relative_to=stage, strict=True)
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
18
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
19 Call Fetch directly::
0
3497a30190d2 initial commit of fetch, WIP
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20
22
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
21 >>> def url(*args):
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
22 ... return 'file://' + os.path.join(*([here] + list(args)))
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
23 >>> f(url=url('sample1.txt'), destination=stage, type='file')
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
24 >>> file(os.path.join(stage, 'sample1.txt')).read().strip()
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
25 'sample1'
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
26
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
27 Cleanup::
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
28
63ff1b00ec05 first passing test
Jeff Hammel <jhammel@mozilla.com>
parents: 21
diff changeset
29 >>> shutil.rmtree(stage)