Fixed typo in manpage
[zeroinstall/zeroinstall-rsl.git] / tests / testdistro.py
blob884bf66e46081105a1700082d1a73d2d986b10a4
1 #!/usr/bin/env python2.4
2 from basetest import BaseTest, empty_feed
3 import sys
4 import unittest
6 sys.path.insert(0, '..')
7 from zeroinstall.injector import distro, model
9 class TestDistro(BaseTest):
10 def setUp(self):
11 BaseTest.setUp(self)
12 self.feed = model.ZeroInstallFeed(empty_feed, local_path = '/empty.xml')
14 def tearDown(self):
15 BaseTest.tearDown(self)
17 def factory(self, id):
18 return self.feed._get_impl(id)
20 def testDefault(self):
21 host = distro.Distribution()
23 host.get_package_info('gimp', self.factory)
24 self.assertEquals(self.feed.implementations, {})
26 def testDebian(self):
27 host = distro._host_distribution
29 self.assertEquals(2, len(host.versions))
31 host.get_package_info('gimp', self.factory)
32 self.assertEquals({}, self.feed.implementations)
34 host.get_package_info('python-bittorrent', self.factory)
35 self.assertEquals(1, len(self.feed.implementations))
36 bittorrent = self.feed.implementations['package:deb:python-bittorrent:3.4.2-10']
37 self.assertEquals('3.4.2-10', bittorrent.get_version())
39 host.get_package_info('libxcomposite-dev', self.factory)
40 self.assertEquals(2, len(self.feed.implementations))
41 libxcomposite = self.feed.implementations['package:deb:libxcomposite-dev:0.3.1-1']
42 self.assertEquals('0.3.1-1', libxcomposite.get_version())
44 def testCleanVersion(self):
45 self.assertEquals('1', distro.try_cleanup_distro_version('1:0.3.1-1'))
46 self.assertEquals('0.3.1-1', distro.try_cleanup_distro_version('0.3.1-1ubuntu0'))
48 suite = unittest.makeSuite(TestDistro)
49 if __name__ == '__main__':
50 sys.argv.append('-v')
51 unittest.main()