]> git.decadent.org.uk Git - dak.git/blob - tests/dbtest_packages.py
Create, test, and refactor get_suite_version_by_package().
[dak.git] / tests / dbtest_packages.py
1 #!/usr/bin/env python
2
3 from db_test import DBDakTestCase
4
5 from daklib.dbconn import Architecture, Suite, get_suite_architectures, \
6     get_architecture_suites, Maintainer, DBSource, Location, PoolFile, \
7     check_poolfile, get_poolfile_like_name, get_source_in_suite, \
8     get_suites_source_in, add_dsc_to_db, source_exists, DBBinary, \
9     get_suites_binary_in, add_deb_to_db
10 from daklib.queue_install import package_to_suite
11 from daklib.queue import get_newest_source, get_suite_version_by_source, \
12     get_source_by_package_and_suite, get_suite_version_by_package
13
14 from sqlalchemy.orm.exc import MultipleResultsFound
15 import unittest
16
17 class Pkg():
18     'fake package class used for testing'
19
20     def __init__(self):
21         self.dsc = {}
22         self.files = {}
23         self.changes = {}
24
25 class Upload():
26     'fake Upload class used for testing'
27
28     def __init__(self, pkg):
29         self.pkg = pkg
30
31 class PackageTestCase(DBDakTestCase):
32     """
33     PackageTestCase checks the handling of source and binary packages in dak's
34     database.
35     """
36
37     def setup_suites(self):
38         "setup a hash of Suite objects in self.suite"
39
40         if 'suite' in self.__dict__:
41             return
42         self.suite = {}
43         for suite_name in ('lenny', 'squeeze', 'sid'):
44             self.suite[suite_name] = Suite(suite_name = suite_name, version = '-')
45         self.session.add_all(self.suite.values())
46
47     def setup_architectures(self):
48         "setup Architecture objects in self.arch and connect to suites"
49
50         if 'arch' in self.__dict__:
51             return
52         self.setup_suites()
53         self.arch = {}
54         for arch_string in ('source', 'all', 'i386', 'amd64', 'kfreebsd-i386'):
55             self.arch[arch_string] = Architecture(arch_string)
56             if arch_string != 'kfreebsd-i386':
57                 self.arch[arch_string].suites = self.suite.values()
58             else:
59                 self.arch[arch_string].suites = [self.suite['squeeze'], self.suite['sid']]
60         # hard code ids for source and all
61         self.arch['source'].arch_id = 1
62         self.arch['all'].arch_id = 2
63         self.session.add_all(self.arch.values())
64
65     def setup_locations(self):
66         'create some Location objects, TODO: add component'
67
68         if 'loc' in self.__dict__:
69             return
70         self.loc = {}
71         self.loc['main'] = Location(path = \
72             '/srv/ftp-master.debian.org/ftp/pool/')
73         self.loc['contrib'] = Location(path = \
74             '/srv/ftp-master.debian.org/ftp/pool/')
75         self.session.add_all(self.loc.values())
76
77     def setup_poolfiles(self):
78         'create some PoolFile objects'
79
80         if 'file' in self.__dict__:
81             return
82         self.setup_locations()
83         self.file = {}
84         self.file['hello_2.2-3.dsc'] = PoolFile(filename = 'main/h/hello/hello_2.2-3.dsc', \
85             location = self.loc['main'], filesize = 0, md5sum = '')
86         self.file['hello_2.2-2.dsc'] = PoolFile(filename = 'main/h/hello/hello_2.2-2.dsc', \
87             location = self.loc['main'], filesize = 0, md5sum = '')
88         self.file['hello_2.2-1.dsc'] = PoolFile(filename = 'main/h/hello/hello_2.2-1.dsc', \
89             location = self.loc['main'], filesize = 0, md5sum = '')
90         self.file['hello_2.2-1_i386.deb'] = PoolFile( \
91             filename = 'main/h/hello/hello_2.2-1_i386.deb', \
92             location = self.loc['main'], filesize = 0, md5sum = '')
93         self.file['gnome-hello_2.2-1_i386.deb'] = PoolFile( \
94             filename = 'main/h/hello/gnome-hello_2.2-1_i386.deb', \
95             location = self.loc['main'], filesize = 0, md5sum = '')
96         self.file['python-hello_2.2-1_all.deb'] = PoolFile( \
97             filename = 'main/h/hello/python-hello_2.2-1_all.deb', \
98             location = self.loc['main'], filesize = 0, md5sum = '')
99         self.file['sl_3.03-16.dsc'] = PoolFile(filename = 'main/s/sl/sl_3.03-16.dsc', \
100             location = self.loc['main'], filesize = 0, md5sum = '')
101         self.file['python2.6_2.6.6-8.dsc'] = PoolFile( \
102             filename = 'main/p/python2.6/python2.6_2.6.6-8.dsc', \
103             location = self.loc['main'], filesize = 0, md5sum = '')
104         self.session.add_all(self.file.values())
105
106     def setup_maintainers(self):
107         'create some Maintainer objects'
108
109         if 'maintainer' in self.__dict__:
110             return
111         self.maintainer = {}
112         self.maintainer['maintainer'] = Maintainer(name = 'Mr. Maintainer')
113         self.maintainer['uploader'] = Maintainer(name = 'Mrs. Uploader')
114         self.maintainer['lazyguy'] = Maintainer(name = 'Lazy Guy')
115         self.session.add_all(self.maintainer.values())
116
117     def setup_sources(self):
118         'create DBSource objects'
119
120         if 'source' in self.__dict__:
121             return
122         self.setup_maintainers()
123         self.setup_suites()
124         self.setup_poolfiles()
125         self.source = {}
126         self.source['hello_2.2-2'] = DBSource(source = 'hello', version = '2.2-2', \
127             maintainer = self.maintainer['maintainer'], \
128             changedby = self.maintainer['uploader'], \
129             poolfile = self.file['hello_2.2-2.dsc'], install_date = self.now())
130         self.source['hello_2.2-2'].suites.append(self.suite['sid'])
131         self.source['hello_2.2-1'] = DBSource(source = 'hello', version = '2.2-1', \
132             maintainer = self.maintainer['maintainer'], \
133             changedby = self.maintainer['uploader'], \
134             poolfile = self.file['hello_2.2-1.dsc'], install_date = self.now())
135         self.source['hello_2.2-1'].suites.append(self.suite['sid'])
136         self.source['sl_3.03-16'] = DBSource(source = 'sl', version = '3.03-16', \
137             maintainer = self.maintainer['maintainer'], \
138             changedby = self.maintainer['uploader'], \
139             poolfile = self.file['sl_3.03-16.dsc'], install_date = self.now())
140         self.source['sl_3.03-16'].suites.append(self.suite['squeeze'])
141         self.source['sl_3.03-16'].suites.append(self.suite['sid'])
142         self.session.add_all(self.source.values())
143
144     def setup_binaries(self):
145         'create DBBinary objects'
146
147         if 'binary' in self.__dict__:
148             return
149         self.setup_sources()
150         self.setup_architectures()
151         self.binary = {}
152         self.binary['hello_2.2-1_i386'] = DBBinary(package = 'hello', \
153             source = self.source['hello_2.2-1'], version = '2.2-1', \
154             maintainer = self.maintainer['maintainer'], \
155             architecture = self.arch['i386'], \
156             poolfile = self.file['hello_2.2-1_i386.deb'])
157         self.binary['hello_2.2-1_i386'].suites.append(self.suite['squeeze'])
158         self.binary['hello_2.2-1_i386'].suites.append(self.suite['sid'])
159         self.binary['gnome-hello_2.2-1_i386'] = DBBinary(package = 'gnome-hello', \
160             source = self.source['hello_2.2-1'], version = '2.2-1', \
161             maintainer = self.maintainer['maintainer'], \
162             architecture = self.arch['i386'], \
163             poolfile = self.file['gnome-hello_2.2-1_i386.deb'])
164         self.binary['gnome-hello_2.2-1_i386'].suites.append(self.suite['squeeze'])
165         self.binary['gnome-hello_2.2-1_i386'].suites.append(self.suite['sid'])
166         self.binary['python-hello_2.2-1_i386'] = DBBinary(package = 'python-hello', \
167             source = self.source['hello_2.2-1'], version = '2.2-1', \
168             maintainer = self.maintainer['maintainer'], \
169             architecture = self.arch['all'], \
170             poolfile = self.file['python-hello_2.2-1_all.deb'])
171         self.binary['python-hello_2.2-1_i386'].suites.append(self.suite['squeeze'])
172         self.session.add_all(self.binary.values())
173
174     def setUp(self):
175         super(PackageTestCase, self).setUp()
176         self.setup_binaries()
177         # flush to make sure that the setup is correct
178         self.session.flush()
179
180     def test_suite_architecture(self):
181         # check the id for architectures source and all
182         self.assertEqual(1, self.arch['source'].arch_id)
183         self.assertEqual(2, self.arch['all'].arch_id)
184         # check the many to many relation between Suite and Architecture
185         self.assertEqual('source', self.suite['lenny'].architectures[0])
186         self.assertEqual(4, len(self.suite['lenny'].architectures))
187         self.assertEqual(3, len(self.arch['i386'].suites))
188         # check the function get_suite_architectures()
189         architectures = get_suite_architectures('lenny', session = self.session)
190         self.assertEqual(4, len(architectures))
191         self.assertTrue(self.arch['source'] in architectures)
192         self.assertTrue(self.arch['all'] in architectures)
193         self.assertTrue(self.arch['kfreebsd-i386'] not in architectures)
194         architectures = get_suite_architectures('sid', session = self.session)
195         self.assertEqual(5, len(architectures))
196         self.assertTrue(self.arch['kfreebsd-i386'] in architectures)
197         architectures = get_suite_architectures('lenny', skipsrc = True, session = self.session)
198         self.assertEqual(3, len(architectures))
199         self.assertTrue(self.arch['source'] not in architectures)
200         architectures = get_suite_architectures('lenny', skipall = True, session = self.session)
201         self.assertEqual(3, len(architectures))
202         self.assertTrue(self.arch['all'] not in architectures)
203         # check the function get_architecture_suites()
204         suites = get_architecture_suites('i386', self.session)
205         self.assertEqual(3, len(suites))
206         self.assertTrue(self.suite['lenny'] in suites)
207         suites = get_architecture_suites('kfreebsd-i386', self.session)
208         self.assertEqual(2, len(suites))
209         self.assertTrue(self.suite['lenny'] not in suites)
210
211     def test_poolfiles(self):
212         '''
213         Test the relation of the classes PoolFile and Location.
214
215         The code needs some explaination. The property Location.files is not a
216         list as in other relations because such a list would become rather
217         huge. It is a query object that can be queried, filtered, and iterated
218         as usual.  But list like methods like append() and remove() are
219         supported as well which allows code like:
220
221         somelocation.files.append(somefile)
222         '''
223
224         main = self.loc['main']
225         contrib = self.loc['contrib']
226         self.assertEqual('/srv/ftp-master.debian.org/ftp/pool/', main.path)
227         count = len(self.file.keys())
228         self.assertEqual(count, main.files.count())
229         self.assertEqual(0, contrib.files.count())
230         poolfile = main.files. \
231                 filter(PoolFile.filename.like('%/hello/hello%')). \
232                 order_by(PoolFile.filename)[0]
233         self.assertEqual('main/h/hello/hello_2.2-1.dsc', poolfile.filename)
234         self.assertEqual(main, poolfile.location)
235         # test get()
236         self.assertEqual(poolfile, \
237                 self.session.query(PoolFile).get(poolfile.file_id))
238         self.assertEqual(None, self.session.query(PoolFile).get(-1))
239         # test remove() and append()
240         main.files.remove(self.file['sl_3.03-16.dsc'])
241         contrib.files.append(self.file['sl_3.03-16.dsc'])
242         self.assertEqual(count - 1, main.files.count())
243         self.assertEqual(1, contrib.files.count())
244         # test fullpath
245         self.assertEqual('/srv/ftp-master.debian.org/ftp/pool/main/s/sl/sl_3.03-16.dsc', \
246             self.file['sl_3.03-16.dsc'].fullpath)
247         # test check_poolfile()
248         self.assertEqual((True, self.file['sl_3.03-16.dsc']), \
249             check_poolfile('main/s/sl/sl_3.03-16.dsc', 0, '', \
250                 contrib.location_id, self.session))
251         self.assertEqual((False, None), \
252             check_poolfile('foobar', 0, '', contrib.location_id, self.session))
253         self.assertEqual((False, self.file['sl_3.03-16.dsc']), \
254             check_poolfile('main/s/sl/sl_3.03-16.dsc', 42, '', \
255                 contrib.location_id, self.session))
256         self.assertEqual((False, self.file['sl_3.03-16.dsc']), \
257             check_poolfile('main/s/sl/sl_3.03-16.dsc', 0, 'deadbeef', \
258                 contrib.location_id, self.session))
259         # test get_poolfile_like_name()
260         self.assertEqual([self.file['sl_3.03-16.dsc']], \
261             get_poolfile_like_name('sl_3.03-16.dsc', self.session))
262         self.assertEqual([], get_poolfile_like_name('foobar', self.session))
263
264     def test_maintainers(self):
265         '''
266         tests relation between Maintainer and DBSource
267
268         TODO: add relations to changes_pending_source
269         '''
270
271         maintainer = self.maintainer['maintainer']
272         self.assertEqual(maintainer,
273             self.session.query(Maintainer).get(maintainer.maintainer_id))
274         uploader = self.maintainer['uploader']
275         self.assertEqual(uploader,
276             self.session.query(Maintainer).get(uploader.maintainer_id))
277         lazyguy = self.maintainer['lazyguy']
278         self.assertEqual(lazyguy,
279             self.session.query(Maintainer).get(lazyguy.maintainer_id))
280         self.assertEqual(3, len(maintainer.maintains_sources))
281         self.assertTrue(self.source['hello_2.2-2'] in maintainer.maintains_sources)
282         self.assertEqual(maintainer.changed_sources, [])
283         self.assertEqual(uploader.maintains_sources, [])
284         self.assertEqual(3, len(uploader.changed_sources))
285         self.assertTrue(self.source['sl_3.03-16'] in uploader.changed_sources)
286         self.assertEqual(lazyguy.maintains_sources, [])
287         self.assertEqual(lazyguy.changed_sources, [])
288
289     def get_source_in_suite_fail(self):
290         '''
291         This function throws the MultipleResultsFound exception because
292         get_source_in_suite is broken.
293
294         TODO: fix get_source_in_suite
295         '''
296
297         return get_source_in_suite('hello', 'sid', self.session)
298
299     def test_sources(self):
300         'test relation between DBSource and PoolFile or Suite'
301
302         # test PoolFile
303         self.assertEqual(self.file['hello_2.2-2.dsc'], self.source['hello_2.2-2'].poolfile)
304         self.assertEqual(self.source['hello_2.2-2'], self.file['hello_2.2-2.dsc'].source)
305         self.assertEqual(None, self.file['python2.6_2.6.6-8.dsc'].source)
306         # test Suite
307         squeeze = self.session.query(Suite). \
308             filter(Suite.sources.contains(self.source['sl_3.03-16'])). \
309             order_by(Suite.suite_name)[1]
310         self.assertEqual(self.suite['squeeze'], squeeze)
311         self.assertEqual(1, squeeze.sources.count())
312         self.assertEqual(self.source['sl_3.03-16'], squeeze.sources[0])
313         sl = self.session.query(DBSource). \
314             filter(DBSource.suites.contains(self.suite['squeeze'])).one()
315         self.assertEqual(self.source['sl_3.03-16'], sl)
316         self.assertEqual(2, len(sl.suites))
317         self.assertTrue(self.suite['sid'] in sl.suites)
318         # test get_source_in_suite()
319         self.assertRaises(MultipleResultsFound, self.get_source_in_suite_fail)
320         self.assertEqual(None, \
321             get_source_in_suite('hello', 'squeeze', self.session))
322         self.assertEqual(self.source['sl_3.03-16'], \
323             get_source_in_suite('sl', 'sid', self.session))
324         # test get_suites_source_in()
325         self.assertEqual([self.suite['sid']], \
326             get_suites_source_in('hello', self.session))
327         self.assertEqual(2, len(get_suites_source_in('sl', self.session)))
328         self.assertTrue(self.suite['squeeze'] in \
329             get_suites_source_in('sl', self.session))
330
331     def test_add_dsc_to_db(self):
332         'tests function add_dsc_to_db()'
333
334         pkg = Pkg()
335         pkg.dsc['source'] = 'hello'
336         pkg.dsc['version'] = '2.2-3'
337         pkg.dsc['maintainer'] = self.maintainer['maintainer'].name
338         pkg.changes['changed-by'] = self.maintainer['uploader'].name
339         pkg.changes['fingerprint'] = 'deadbeef'
340         pkg.changes['distribution'] = { 'sid': '' }
341         pkg.files['hello_2.2-3.dsc'] = { \
342             'component': 'main',
343             'location id': self.loc['main'].location_id,
344             'files id': self.file['hello_2.2-3.dsc'].file_id }
345         pkg.dsc_files = {}
346         upload = Upload(pkg)
347         (source, dsc_component, dsc_location_id, pfs) = \
348             add_dsc_to_db(upload, 'hello_2.2-3.dsc', self.session)
349         self.assertEqual('hello', source.source)
350         self.assertEqual('2.2-3', source.version)
351         self.assertEqual('sid', source.suites[0].suite_name)
352         self.assertEqual('main', dsc_component)
353         self.assertEqual(self.loc['main'].location_id, dsc_location_id)
354         self.assertEqual([], pfs)
355
356     def test_source_exists(self):
357         'test function source_exists()'
358
359         hello = self.source['hello_2.2-2']
360         self.assertTrue(source_exists(hello.source, hello.version, \
361             suites = ['sid'], session = self.session))
362         # binNMU
363         self.assertTrue(source_exists(hello.source, hello.version + '+b7', \
364             suites = ['sid'], session = self.session))
365         self.assertTrue(not source_exists(hello.source, hello.version, \
366             suites = ['lenny', 'squeeze'], session = self.session))
367         self.assertTrue(not source_exists(hello.source, hello.version, \
368             suites = ['lenny', 'sid'], session = self.session))
369         self.assertTrue(not source_exists(hello.source, hello.version, \
370             suites = ['sid', 'lenny'], session = self.session))
371         self.assertTrue(not source_exists(hello.source, '0815', \
372             suites = ['sid'], session = self.session))
373         # 'any' suite
374         self.assertTrue(source_exists(hello.source, hello.version, \
375             session = self.session))
376
377     def test_package_to_suite(self):
378         'test function package_to_suite()'
379
380         pkg = Pkg()
381         pkg.changes = { 'distribution': {} }
382         upload = Upload(pkg)
383         self.assertTrue(not package_to_suite(upload, 'sid', self.session))
384         pkg.changes['distribution'] = { 'sid': '' }
385         pkg.changes['architecture'] = { 'source': '' }
386         self.assertTrue(package_to_suite(upload, 'sid', self.session))
387         pkg.changes['architecture'] = {}
388         pkg.changes['source'] = self.source['hello_2.2-2'].source
389         pkg.changes['version'] = self.source['hello_2.2-2'].version
390         self.assertTrue(not package_to_suite(upload, 'sid', self.session))
391         pkg.changes['version'] = '42'
392         self.assertTrue(package_to_suite(upload, 'sid', self.session))
393         pkg.changes['source'] = 'foobar'
394         pkg.changes['version'] = self.source['hello_2.2-2'].version
395         self.assertTrue(package_to_suite(upload, 'sid', self.session))
396         pkg.changes['distribution'] = { 'lenny': '' }
397         self.assertTrue(package_to_suite(upload, 'lenny', self.session))
398
399     def test_get_newest_source(self):
400         'test function get_newest_source()'
401
402         import daklib.queue
403         daklib.queue.dm_suites = ['sid']
404         self.assertEqual(self.source['hello_2.2-2'], get_newest_source('hello', self.session))
405         self.assertEqual(None, get_newest_source('foobar', self.session))
406
407     def test_get_suite_version_by_source(self):
408         'test function get_suite_version_by_source()'
409
410         result = get_suite_version_by_source('hello', self.session)
411         self.assertEqual(2, len(result))
412         self.assertTrue(('sid', '2.2-1') in result)
413         self.assertTrue(('sid', '2.2-2') in result)
414         result = get_suite_version_by_source('sl', self.session)
415         self.assertEqual(2, len(result))
416         self.assertTrue(('squeeze', '3.03-16') in result)
417         self.assertTrue(('sid', '3.03-16') in result)
418
419     def test_binaries(self):
420         '''
421         tests class DBBinary; TODO: test relation with Architecture, Maintainer,
422         PoolFile, and Fingerprint
423         '''
424
425         # test Suite relation
426         self.assertEqual(2, self.suite['sid'].binaries.count())
427         self.assertTrue(self.binary['hello_2.2-1_i386'] in \
428             self.suite['sid'].binaries.all())
429         self.assertEqual(0, self.suite['lenny'].binaries.count())
430         # test DBSource relation
431         self.assertEqual(3, len(self.source['hello_2.2-1'].binaries))
432         self.assertTrue(self.binary['hello_2.2-1_i386'] in \
433             self.source['hello_2.2-1'].binaries)
434         self.assertEqual(0, len(self.source['hello_2.2-2'].binaries))
435         # test get_suites_binary_in()
436         self.assertEqual(2, len(get_suites_binary_in('hello', self.session)))
437         self.assertTrue(self.suite['sid'] in \
438             get_suites_binary_in('hello', self.session))
439         self.assertEqual(2, len(get_suites_binary_in('gnome-hello', self.session)))
440         self.assertTrue(self.suite['squeeze'] in \
441             get_suites_binary_in('gnome-hello', self.session))
442         self.assertEqual(0, len(get_suites_binary_in('sl', self.session)))
443
444     def test_add_deb_to_db(self):
445         'tests function add_deb_to_db()'
446
447         pkg = Pkg()
448         pkg.changes['fingerprint'] = 'deadbeef'
449         pkg.changes['distribution'] = { 'sid': '' }
450         pkg.files['hello_2.2-2_i386.deb'] = { \
451             'package': 'hello',
452             'version': '2.2-2',
453             'maintainer': self.maintainer['maintainer'].name,
454             'architecture': 'i386',
455             'dbtype': 'deb',
456             'pool name': 'main/h/hello/',
457             'location id': self.loc['main'].location_id,
458             'source package': 'hello',
459             'source version': '2.2-2',
460             'size': 0,
461             'md5sum': 'deadbeef',
462             'sha1sum': 'deadbeef',
463             'sha256sum': 'deadbeef'}
464         upload = Upload(pkg)
465         poolfile = add_deb_to_db(upload, 'hello_2.2-2_i386.deb', self.session)
466         self.session.refresh(poolfile)
467         self.session.refresh(poolfile.binary)
468         self.assertEqual('main/h/hello/hello_2.2-2_i386.deb', poolfile.filename)
469         self.assertEqual('hello', poolfile.binary.package)
470         self.assertEqual('2.2-2', poolfile.binary.version)
471         self.assertEqual(['sid'], poolfile.binary.suites)
472         self.assertEqual('Mr. Maintainer', poolfile.binary.maintainer.name)
473         self.assertEqual('i386', poolfile.binary.architecture.arch_string)
474         self.assertEqual('deb', poolfile.binary.binarytype)
475         self.assertEqual(self.loc['main'], poolfile.location)
476         self.assertEqual(self.source['hello_2.2-2'], poolfile.binary.source)
477         self.assertEqual(0, poolfile.filesize)
478         self.assertEqual('deadbeef', poolfile.md5sum)
479         self.assertEqual('deadbeef', poolfile.sha1sum)
480         self.assertEqual('deadbeef', poolfile.sha256sum)
481
482     def test_get_source_by_package_and_suite(self):
483         'test get_source_by_package_and_suite()'
484
485         query = get_source_by_package_and_suite('hello', 'sid', self.session)
486         self.assertEqual(self.source['hello_2.2-1'], query.one())
487         query = get_source_by_package_and_suite('gnome-hello', 'squeeze', self.session)
488         self.assertEqual(self.source['hello_2.2-1'], query.one())
489         query = get_source_by_package_and_suite('hello', 'hamm', self.session)
490         self.assertEqual(0, query.count())
491         query = get_source_by_package_and_suite('foobar', 'squeeze', self.session)
492         self.assertEqual(0, query.count())
493
494     def test_get_suite_version_by_package(self):
495         'test function get_suite_version_by_package()'
496
497         result = get_suite_version_by_package('hello', 'i386', self.session)
498         self.assertEqual(2, len(result))
499         self.assertTrue(('sid', '2.2-1') in result)
500         result = get_suite_version_by_package('hello', 'amd64', self.session)
501         self.assertEqual(0, len(result))
502         result = get_suite_version_by_package('python-hello', 'i386', self.session)
503         self.assertEqual([('squeeze', '2.2-1')], result)
504         result = get_suite_version_by_package('python-hello', 'amd64', self.session)
505         self.assertEqual([('squeeze', '2.2-1')], result)
506
507 if __name__ == '__main__':
508     unittest.main()