1 #!/usr/bin/env python2.5
2 # Copyright (C) 2007, Thomas Leonard
3 # See the README file for details, or visit http://0install.net.
4 import sys
, os
, shutil
, tempfile
, subprocess
7 sys
.path
.insert(0, '..')
11 mydir
= os
.path
.realpath(os
.path
.dirname(__file__
))
12 release_feed
= mydir
+ '/../0release.xml'
13 test_repo
= mydir
+ '/test-repo.tgz'
14 test_gpg
= mydir
+ '/gpg.tgz'
16 class TestRelease(unittest
.TestCase
):
18 self
.tmp
= tempfile
.mkdtemp(prefix
= '0release-')
20 support
.check_call(['tar', 'xzf', test_repo
])
21 support
.check_call(['tar', 'xzf', test_gpg
])
23 os
.environ
['GNUPGHOME'] = self
.tmp
+ '/gpg'
27 shutil
.rmtree(self
.tmp
)
31 support
.check_call(['0launch', release_feed
, '../hello/HelloWorld.xml'])
32 assert os
.path
.isfile('make-release')
34 child
= subprocess
.Popen(['./make-release', '-k', 'Testing'], stdin
= subprocess
.PIPE
)
35 unused
, unused
= child
.communicate('\nP\n')
36 assert child
.returncode
== 0
38 child
= subprocess
.Popen(['./make-release', '-k', 'Testing'], stdin
= subprocess
.PIPE
)
39 unused
, unused
= child
.communicate('\nP\n')
40 assert child
.returncode
== 0
42 assert 'Prints "Hello World"' in file('changelog-0.1').read()
43 assert 'Prints "Hello World"' not in file('changelog-0.2').read()
45 suite
= unittest
.makeSuite(TestRelease
)
46 if __name__
== '__main__':