comparison examples/doctest.txt @ 95:e74baa8e6df4

fix CLI interface a bit....write a test for it
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 11 Jan 2011 09:06:25 -0800
parents 672d2d3ee322
children b54898f7d8a9
comparison
equal deleted inserted replaced
94:b6a46332cced 95:e74baa8e6df4
100 >>> apitemplate.substitute({}, buffer) 100 >>> apitemplate.substitute({}, buffer)
101 >>> file(buffer).read().strip() 101 >>> file(buffer).read().strip()
102 'Hello bar' 102 'Hello bar'
103 >>> os.remove(buffer) 103 >>> os.remove(buffer)
104 104
105 Test CLI handler:
106
107 >>> from makeitso.cli import MakeItSoCLI
108 >>> cli = MakeItSoCLI(MyTemplate)
109 >>> buffer = tempfile.mktemp()
110 >>> cli(buffer)
111 >>> os.remove(buffer)
112
105 Test to make sure permissions are preserved. This won't work on windows:: 113 Test to make sure permissions are preserved. This won't work on windows::
106 114
107 >>> buffer = tempfile.mktemp() 115 >>> buffer = tempfile.mktemp()
108 >>> f = file(buffer, 'w') 116 >>> f = file(buffer, 'w')
109 >>> print >> f, '#!/bin/bash\necho foo' 117 >>> print >> f, '#!/bin/bash\necho foo'