annotate tests/doctest.txt @ 13:f522620c6a78

now works properly with tarballs
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 08 Jul 2011 15:20:01 -0700
parents d1f090c5f291
children 996d579f0dc3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5
7ea2b5f12b2d stub tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 Test carton
7ea2b5f12b2d stub tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2 ===========
7ea2b5f12b2d stub tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3
7ea2b5f12b2d stub tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 The obligatory imports:
7ea2b5f12b2d stub tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5
7ea2b5f12b2d stub tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6 >>> import carton
8
5905459d4ebe now have a passing if somewhat rudimentary test
Jeff Hammel <jhammel@mozilla.com>
parents: 7
diff changeset
7 >>> import os
7
111ffe84f66a more stubbing
Jeff Hammel <jhammel@mozilla.com>
parents: 5
diff changeset
8
111ffe84f66a more stubbing
Jeff Hammel <jhammel@mozilla.com>
parents: 5
diff changeset
9 Make a temporary directory::
111ffe84f66a more stubbing
Jeff Hammel <jhammel@mozilla.com>
parents: 5
diff changeset
10
5
7ea2b5f12b2d stub tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11 >>> import tempfile
7
111ffe84f66a more stubbing
Jeff Hammel <jhammel@mozilla.com>
parents: 5
diff changeset
12 >>> directory = tempfile.mkdtemp()
5
7ea2b5f12b2d stub tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13
9
aa673036ecc1 correct string
Jeff Hammel <jhammel@mozilla.com>
parents: 8
diff changeset
14 Invoke carton::
5
7ea2b5f12b2d stub tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15
8
5905459d4ebe now have a passing if somewhat rudimentary test
Jeff Hammel <jhammel@mozilla.com>
parents: 7
diff changeset
16 >>> os.chdir(directory)
13
f522620c6a78 now works properly with tarballs
Jeff Hammel <jhammel@mozilla.com>
parents: 10
diff changeset
17 >>> packages = [os.path.join(here, i) for i in 'packageC.tar.gz', 'packageB', 'packageA']
8
5905459d4ebe now have a passing if somewhat rudimentary test
Jeff Hammel <jhammel@mozilla.com>
parents: 7
diff changeset
18 >>> carton.main(['foo'] + packages)
5905459d4ebe now have a passing if somewhat rudimentary test
Jeff Hammel <jhammel@mozilla.com>
parents: 7
diff changeset
19 >>> os.listdir('.')
5905459d4ebe now have a passing if somewhat rudimentary test
Jeff Hammel <jhammel@mozilla.com>
parents: 7
diff changeset
20 ['foo.py']
5
7ea2b5f12b2d stub tests
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
21
10
d1f090c5f291 lets make some more tests
Jeff Hammel <jhammel@mozilla.com>
parents: 9
diff changeset
22 Invoke the foo.py it creates::
d1f090c5f291 lets make some more tests
Jeff Hammel <jhammel@mozilla.com>
parents: 9
diff changeset
23
d1f090c5f291 lets make some more tests
Jeff Hammel <jhammel@mozilla.com>
parents: 9
diff changeset
24 >>> import subprocess
d1f090c5f291 lets make some more tests
Jeff Hammel <jhammel@mozilla.com>
parents: 9
diff changeset
25 >>> subprocess.call([python, 'foo.py'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
d1f090c5f291 lets make some more tests
Jeff Hammel <jhammel@mozilla.com>
parents: 9
diff changeset
26 0
d1f090c5f291 lets make some more tests
Jeff Hammel <jhammel@mozilla.com>
parents: 9
diff changeset
27 >>> sorted(os.listdir('.'))
d1f090c5f291 lets make some more tests
Jeff Hammel <jhammel@mozilla.com>
parents: 9
diff changeset
28 ['foo', 'foo.py']
d1f090c5f291 lets make some more tests
Jeff Hammel <jhammel@mozilla.com>
parents: 9
diff changeset
29 >>> os.path.isdir('foo')
d1f090c5f291 lets make some more tests
Jeff Hammel <jhammel@mozilla.com>
parents: 9
diff changeset
30 True
d1f090c5f291 lets make some more tests
Jeff Hammel <jhammel@mozilla.com>
parents: 9
diff changeset
31 >>> sorted(os.listdir(os.path.join('foo', 'src')))
13
f522620c6a78 now works properly with tarballs
Jeff Hammel <jhammel@mozilla.com>
parents: 10
diff changeset
32 ['packageA', 'packageB', 'packageC']
10
d1f090c5f291 lets make some more tests
Jeff Hammel <jhammel@mozilla.com>
parents: 9
diff changeset
33
7
111ffe84f66a more stubbing
Jeff Hammel <jhammel@mozilla.com>
parents: 5
diff changeset
34 Clean up::
111ffe84f66a more stubbing
Jeff Hammel <jhammel@mozilla.com>
parents: 5
diff changeset
35
111ffe84f66a more stubbing
Jeff Hammel <jhammel@mozilla.com>
parents: 5
diff changeset
36 >>> import shutil
111ffe84f66a more stubbing
Jeff Hammel <jhammel@mozilla.com>
parents: 5
diff changeset
37 >>> shutil.rmtree(directory)