Merge lp:~cprov/britney/test-refactoring into lp:~ubuntu-release/britney/britney2-ubuntu
- test-refactoring
- Merge into britney2-ubuntu
Proposed by
Celso Providelo
Status: | Merged |
---|---|
Merged at revision: | 430 |
Proposed branch: | lp:~cprov/britney/test-refactoring |
Merge into: | lp:~ubuntu-release/britney/britney2-ubuntu |
Diff against target: |
441 lines (+209/-183) 2 files modified
tests/__init__.py (+159/-0) tests/test_autopkgtest.py (+50/-183) |
To merge this branch: | bzr merge lp:~cprov/britney/test-refactoring |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson (community) | Approve | ||
Ubuntu Release Team | Pending | ||
Review via email: mp+247319@code.launchpad.net |
Commit message
Basic testing refactoring before we can implement "boottest" support.
Description of the change
Basic testing refactoring before we can implement "boottest" support.
To post a comment you must log in.
- 431. By Celso Providelo
-
Reverting whitespace cleanup.
Revision history for this message
Colin Watson (cjwatson) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'tests/__init__.py' | |||
2 | --- tests/__init__.py 1970-01-01 00:00:00 +0000 | |||
3 | +++ tests/__init__.py 2015-01-22 17:16:43 +0000 | |||
4 | @@ -0,0 +1,159 @@ | |||
5 | 1 | # (C) 2015 Canonical Ltd. | ||
6 | 2 | # | ||
7 | 3 | # This program is free software; you can redistribute it and/or modify | ||
8 | 4 | # it under the terms of the GNU General Public License as published by | ||
9 | 5 | # the Free Software Foundation; either version 2 of the License, or | ||
10 | 6 | # (at your option) any later version. | ||
11 | 7 | |||
12 | 8 | import os | ||
13 | 9 | import shutil | ||
14 | 10 | import subprocess | ||
15 | 11 | import tempfile | ||
16 | 12 | import unittest | ||
17 | 13 | |||
18 | 14 | |||
19 | 15 | PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
20 | 16 | |||
21 | 17 | architectures = ['amd64', 'arm64', 'armhf', 'i386', 'powerpc', 'ppc64el'] | ||
22 | 18 | |||
23 | 19 | |||
24 | 20 | class TestData: | ||
25 | 21 | |||
26 | 22 | def __init__(self): | ||
27 | 23 | '''Construct local test package indexes. | ||
28 | 24 | |||
29 | 25 | The archive is initially empty. You can create new packages with | ||
30 | 26 | create_deb(). self.path contains the path of the archive, and | ||
31 | 27 | self.apt_source provides an apt source "deb" line. | ||
32 | 28 | |||
33 | 29 | It is kept in a temporary directory which gets removed when the Archive | ||
34 | 30 | object gets deleted. | ||
35 | 31 | ''' | ||
36 | 32 | self.path = tempfile.mkdtemp(prefix='testarchive.') | ||
37 | 33 | self.apt_source = 'deb file://%s /' % self.path | ||
38 | 34 | self.series = 'series' | ||
39 | 35 | self.dirs = {False: os.path.join(self.path, 'data', self.series), | ||
40 | 36 | True: os.path.join( | ||
41 | 37 | self.path, 'data', '%s-proposed' % self.series)} | ||
42 | 38 | os.makedirs(self.dirs[False]) | ||
43 | 39 | os.mkdir(self.dirs[True]) | ||
44 | 40 | self.added_sources = {False: set(), True: set()} | ||
45 | 41 | self.added_binaries = {False: set(), True: set()} | ||
46 | 42 | |||
47 | 43 | # pre-create all files for all architectures | ||
48 | 44 | for arch in architectures: | ||
49 | 45 | for dir in self.dirs.values(): | ||
50 | 46 | with open(os.path.join(dir, 'Packages_' + arch), 'w'): | ||
51 | 47 | pass | ||
52 | 48 | for dir in self.dirs.values(): | ||
53 | 49 | for fname in ['Dates', 'Blocks']: | ||
54 | 50 | with open(os.path.join(dir, fname), 'w'): | ||
55 | 51 | pass | ||
56 | 52 | for dname in ['Hints']: | ||
57 | 53 | os.mkdir(os.path.join(dir, dname)) | ||
58 | 54 | |||
59 | 55 | os.mkdir(os.path.join(self.path, 'output')) | ||
60 | 56 | |||
61 | 57 | # create temporary home dir for proposed-migration autopktest status | ||
62 | 58 | self.home = os.path.join(self.path, 'home') | ||
63 | 59 | os.environ['HOME'] = self.home | ||
64 | 60 | os.makedirs(os.path.join(self.home, 'proposed-migration', | ||
65 | 61 | 'autopkgtest', 'work')) | ||
66 | 62 | |||
67 | 63 | def __del__(self): | ||
68 | 64 | shutil.rmtree(self.path) | ||
69 | 65 | |||
70 | 66 | def add(self, name, unstable, fields={}, add_src=True): | ||
71 | 67 | '''Add a binary package to the index file. | ||
72 | 68 | |||
73 | 69 | You need to specify at least the package name and in which list to put | ||
74 | 70 | it (unstable==True for unstable/proposed, or False for | ||
75 | 71 | testing/release). fields specifies all additional entries, e. g. | ||
76 | 72 | {'Depends': 'foo, bar', 'Conflicts: baz'}. There are defaults for most | ||
77 | 73 | fields. | ||
78 | 74 | |||
79 | 75 | Unless add_src is set to False, this will also automatically create a | ||
80 | 76 | source record, based on fields['Source'] and name. | ||
81 | 77 | ''' | ||
82 | 78 | assert (name not in self.added_binaries[unstable]) | ||
83 | 79 | self.added_binaries[unstable].add(name) | ||
84 | 80 | |||
85 | 81 | fields.setdefault('Architecture', architectures[0]) | ||
86 | 82 | fields.setdefault('Version', '1') | ||
87 | 83 | fields.setdefault('Priority', 'optional') | ||
88 | 84 | fields.setdefault('Section', 'devel') | ||
89 | 85 | fields.setdefault('Description', 'test pkg') | ||
90 | 86 | if fields['Architecture'] == 'all': | ||
91 | 87 | for a in architectures: | ||
92 | 88 | self._append(name, unstable, 'Packages_' + a, fields) | ||
93 | 89 | else: | ||
94 | 90 | self._append(name, unstable, 'Packages_' + fields['Architecture'], | ||
95 | 91 | fields) | ||
96 | 92 | |||
97 | 93 | if add_src: | ||
98 | 94 | src = fields.get('Source', name) | ||
99 | 95 | if src not in self.added_sources[unstable]: | ||
100 | 96 | self.add_src(src, unstable, {'Version': fields['Version'], | ||
101 | 97 | 'Section': fields['Section']}) | ||
102 | 98 | |||
103 | 99 | def add_src(self, name, unstable, fields={}): | ||
104 | 100 | '''Add a source package to the index file. | ||
105 | 101 | |||
106 | 102 | You need to specify at least the package name and in which list to put | ||
107 | 103 | it (unstable==True for unstable/proposed, or False for | ||
108 | 104 | testing/release). fields specifies all additional entries, which can be | ||
109 | 105 | Version (default: 1), Section (default: devel), and Extra-Source-Only. | ||
110 | 106 | ''' | ||
111 | 107 | assert (name not in self.added_sources[unstable]) | ||
112 | 108 | self.added_sources[unstable].add(name) | ||
113 | 109 | |||
114 | 110 | fields.setdefault('Version', '1') | ||
115 | 111 | fields.setdefault('Section', 'devel') | ||
116 | 112 | self._append(name, unstable, 'Sources', fields) | ||
117 | 113 | |||
118 | 114 | def _append(self, name, unstable, file_name, fields): | ||
119 | 115 | with open(os.path.join(self.dirs[unstable], file_name), 'a') as f: | ||
120 | 116 | f.write('''Package: %s | ||
121 | 117 | Maintainer: Joe <joe@example.com> | ||
122 | 118 | ''' % name) | ||
123 | 119 | |||
124 | 120 | for k, v in fields.items(): | ||
125 | 121 | f.write('%s: %s\n' % (k, v)) | ||
126 | 122 | f.write('\n') | ||
127 | 123 | |||
128 | 124 | |||
129 | 125 | class TestBase(unittest.TestCase): | ||
130 | 126 | |||
131 | 127 | def setUp(self): | ||
132 | 128 | super(TestBase, self).setUp() | ||
133 | 129 | self.data = TestData() | ||
134 | 130 | self.britney = os.path.join(PROJECT_DIR, 'britney.py') | ||
135 | 131 | self.britney_conf = os.path.join(PROJECT_DIR, 'britney.conf') | ||
136 | 132 | assert os.path.exists(self.britney) | ||
137 | 133 | assert os.path.exists(self.britney_conf) | ||
138 | 134 | |||
139 | 135 | def tearDown(self): | ||
140 | 136 | del self.data | ||
141 | 137 | |||
142 | 138 | def run_britney(self, args=[]): | ||
143 | 139 | '''Run britney. | ||
144 | 140 | |||
145 | 141 | Assert that it succeeds and does not produce anything on stderr. | ||
146 | 142 | Return (excuses.html, britney_out). | ||
147 | 143 | ''' | ||
148 | 144 | britney = subprocess.Popen([self.britney, '-v', '-c', self.britney_conf, | ||
149 | 145 | '--distribution=ubuntu', | ||
150 | 146 | '--series=%s' % self.data.series], | ||
151 | 147 | stdout=subprocess.PIPE, | ||
152 | 148 | stderr=subprocess.PIPE, | ||
153 | 149 | cwd=self.data.path, | ||
154 | 150 | universal_newlines=True) | ||
155 | 151 | (out, err) = britney.communicate() | ||
156 | 152 | self.assertEqual(britney.returncode, 0, out + err) | ||
157 | 153 | self.assertEqual(err, '') | ||
158 | 154 | |||
159 | 155 | with open(os.path.join(self.data.path, 'output', self.data.series, | ||
160 | 156 | 'excuses.html')) as f: | ||
161 | 157 | excuses = f.read() | ||
162 | 158 | |||
163 | 159 | return (excuses, out) | ||
164 | 0 | 160 | ||
165 | === modified file 'tests/test_autopkgtest.py' | |||
166 | --- tests/test_autopkgtest.py 2014-12-10 10:42:27 +0000 | |||
167 | +++ tests/test_autopkgtest.py 2015-01-22 17:16:43 +0000 | |||
168 | @@ -6,133 +6,40 @@ | |||
169 | 6 | # the Free Software Foundation; either version 2 of the License, or | 6 | # the Free Software Foundation; either version 2 of the License, or |
170 | 7 | # (at your option) any later version. | 7 | # (at your option) any later version. |
171 | 8 | 8 | ||
174 | 9 | import tempfile | 9 | import apt_pkg |
175 | 10 | import shutil | 10 | import operator |
176 | 11 | import os | 11 | import os |
177 | 12 | import sys | 12 | import sys |
178 | 13 | import subprocess | 13 | import subprocess |
179 | 14 | import unittest | 14 | import unittest |
187 | 15 | import apt_pkg | 15 | |
188 | 16 | import operator | 16 | PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
189 | 17 | 17 | sys.path.insert(0, PROJECT_DIR) | |
190 | 18 | apt_pkg.init() | 18 | |
191 | 19 | architectures = ['amd64', 'arm64', 'armhf', 'i386', 'powerpc', 'ppc64el'] | 19 | from autopkgtest import ADT_EXCUSES_LABELS |
192 | 20 | 20 | from tests import TestBase | |
186 | 21 | my_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
193 | 22 | 21 | ||
194 | 23 | NOT_CONSIDERED = False | 22 | NOT_CONSIDERED = False |
195 | 24 | VALID_CANDIDATE = True | 23 | VALID_CANDIDATE = True |
196 | 25 | 24 | ||
305 | 26 | sys.path.insert(0, my_dir) | 25 | |
306 | 27 | from autopkgtest import ADT_EXCUSES_LABELS | 26 | apt_pkg.init() |
307 | 28 | 27 | ||
308 | 29 | 28 | ||
309 | 30 | class TestData: | 29 | class TestAutoPkgTest(TestBase): |
310 | 31 | def __init__(self): | 30 | |
203 | 32 | '''Construct local test package indexes. | ||
204 | 33 | |||
205 | 34 | The archive is initially empty. You can create new packages with | ||
206 | 35 | create_deb(). self.path contains the path of the archive, and | ||
207 | 36 | self.apt_source provides an apt source "deb" line. | ||
208 | 37 | |||
209 | 38 | It is kept in a temporary directory which gets removed when the Archive | ||
210 | 39 | object gets deleted. | ||
211 | 40 | ''' | ||
212 | 41 | self.path = tempfile.mkdtemp(prefix='testarchive.') | ||
213 | 42 | self.apt_source = 'deb file://%s /' % self.path | ||
214 | 43 | self.series = 'series' | ||
215 | 44 | self.dirs = {False: os.path.join(self.path, 'data', self.series), | ||
216 | 45 | True: os.path.join(self.path, 'data', '%s-proposed' % self.series)} | ||
217 | 46 | os.makedirs(self.dirs[False]) | ||
218 | 47 | os.mkdir(self.dirs[True]) | ||
219 | 48 | self.added_sources = {False: set(), True: set()} | ||
220 | 49 | self.added_binaries = {False: set(), True: set()} | ||
221 | 50 | |||
222 | 51 | # pre-create all files for all architectures | ||
223 | 52 | for arch in architectures: | ||
224 | 53 | for dir in self.dirs.values(): | ||
225 | 54 | with open(os.path.join(dir, 'Packages_' + arch), 'w'): | ||
226 | 55 | pass | ||
227 | 56 | for dir in self.dirs.values(): | ||
228 | 57 | for fname in ['Dates', 'Blocks']: | ||
229 | 58 | with open(os.path.join(dir, fname), 'w'): | ||
230 | 59 | pass | ||
231 | 60 | for dname in ['Hints']: | ||
232 | 61 | os.mkdir(os.path.join(dir, dname)) | ||
233 | 62 | |||
234 | 63 | os.mkdir(os.path.join(self.path, 'output')) | ||
235 | 64 | |||
236 | 65 | # create temporary home dir for proposed-migration autopktest status | ||
237 | 66 | self.home = os.path.join(self.path, 'home') | ||
238 | 67 | os.environ['HOME'] = self.home | ||
239 | 68 | os.makedirs(os.path.join(self.home, 'proposed-migration', | ||
240 | 69 | 'autopkgtest', 'work')) | ||
241 | 70 | |||
242 | 71 | def __del__(self): | ||
243 | 72 | shutil.rmtree(self.path) | ||
244 | 73 | |||
245 | 74 | def add(self, name, unstable, fields={}, add_src=True): | ||
246 | 75 | '''Add a binary package to the index file. | ||
247 | 76 | |||
248 | 77 | You need to specify at least the package name and in which list to put | ||
249 | 78 | it (unstable==True for unstable/proposed, or False for | ||
250 | 79 | testing/release). fields specifies all additional entries, e. g. | ||
251 | 80 | {'Depends': 'foo, bar', 'Conflicts: baz'}. There are defaults for most | ||
252 | 81 | fields. | ||
253 | 82 | |||
254 | 83 | Unless add_src is set to False, this will also automatically create a | ||
255 | 84 | source record, based on fields['Source'] and name. | ||
256 | 85 | ''' | ||
257 | 86 | assert (name not in self.added_binaries[unstable]) | ||
258 | 87 | self.added_binaries[unstable].add(name) | ||
259 | 88 | |||
260 | 89 | fields.setdefault('Architecture', architectures[0]) | ||
261 | 90 | fields.setdefault('Version', '1') | ||
262 | 91 | fields.setdefault('Priority', 'optional') | ||
263 | 92 | fields.setdefault('Section', 'devel') | ||
264 | 93 | fields.setdefault('Description', 'test pkg') | ||
265 | 94 | if fields['Architecture'] == 'all': | ||
266 | 95 | for a in architectures: | ||
267 | 96 | self._append(name, unstable, 'Packages_' + a, fields) | ||
268 | 97 | else: | ||
269 | 98 | self._append(name, unstable, 'Packages_' + fields['Architecture'], | ||
270 | 99 | fields) | ||
271 | 100 | |||
272 | 101 | if add_src: | ||
273 | 102 | src = fields.get('Source', name) | ||
274 | 103 | if src not in self.added_sources[unstable]: | ||
275 | 104 | self.add_src(src, unstable, {'Version': fields['Version'], | ||
276 | 105 | 'Section': fields['Section']}) | ||
277 | 106 | |||
278 | 107 | def add_src(self, name, unstable, fields={}): | ||
279 | 108 | '''Add a source package to the index file. | ||
280 | 109 | |||
281 | 110 | You need to specify at least the package name and in which list to put | ||
282 | 111 | it (unstable==True for unstable/proposed, or False for | ||
283 | 112 | testing/release). fields specifies all additional entries, which can be | ||
284 | 113 | Version (default: 1), Section (default: devel), and Extra-Source-Only. | ||
285 | 114 | ''' | ||
286 | 115 | assert (name not in self.added_sources[unstable]) | ||
287 | 116 | self.added_sources[unstable].add(name) | ||
288 | 117 | |||
289 | 118 | fields.setdefault('Version', '1') | ||
290 | 119 | fields.setdefault('Section', 'devel') | ||
291 | 120 | self._append(name, unstable, 'Sources', fields) | ||
292 | 121 | |||
293 | 122 | def _append(self, name, unstable, file_name, fields): | ||
294 | 123 | with open(os.path.join(self.dirs[unstable], file_name), 'a') as f: | ||
295 | 124 | f.write('''Package: %s | ||
296 | 125 | Maintainer: Joe <joe@example.com> | ||
297 | 126 | ''' % name) | ||
298 | 127 | |||
299 | 128 | for k, v in fields.items(): | ||
300 | 129 | f.write('%s: %s\n' % (k, v)) | ||
301 | 130 | f.write('\n') | ||
302 | 131 | |||
303 | 132 | |||
304 | 133 | class Test(unittest.TestCase): | ||
311 | 134 | def setUp(self): | 31 | def setUp(self): |
313 | 135 | self.data = TestData() | 32 | super(TestAutoPkgTest, self).setUp() |
314 | 33 | |||
315 | 34 | # fake adt-britney script | ||
316 | 35 | self.adt_britney = os.path.join( | ||
317 | 36 | self.data.home, 'auto-package-testing', 'jenkins', 'adt-britney') | ||
318 | 37 | os.makedirs(os.path.dirname(self.adt_britney)) | ||
319 | 38 | |||
320 | 39 | with open(self.adt_britney, 'w') as f: | ||
321 | 40 | f.write('''#!/bin/sh -e | ||
322 | 41 | echo "$@" >> /%s/adt-britney.log ''' % self.data.path) | ||
323 | 42 | os.chmod(self.adt_britney, 0o755) | ||
324 | 136 | 43 | ||
325 | 137 | # add a bunch of packages to testing to avoid repetition | 44 | # add a bunch of packages to testing to avoid repetition |
326 | 138 | self.data.add('libc6', False) | 45 | self.data.add('libc6', False) |
327 | @@ -146,24 +53,6 @@ | |||
328 | 146 | 'Conflicts': 'green'}) | 53 | 'Conflicts': 'green'}) |
329 | 147 | self.data.add('justdata', False, {'Architecture': 'all'}) | 54 | self.data.add('justdata', False, {'Architecture': 'all'}) |
330 | 148 | 55 | ||
331 | 149 | self.britney = os.path.join(my_dir, 'britney.py') | ||
332 | 150 | self.britney_conf = os.path.join(my_dir, 'britney.conf') | ||
333 | 151 | assert os.path.exists(self.britney) | ||
334 | 152 | assert os.path.exists(self.britney_conf) | ||
335 | 153 | |||
336 | 154 | # fake adt-britney script | ||
337 | 155 | self.adt_britney = os.path.join(self.data.home, 'auto-package-testing', | ||
338 | 156 | 'jenkins', 'adt-britney') | ||
339 | 157 | os.makedirs(os.path.dirname(self.adt_britney)) | ||
340 | 158 | |||
341 | 159 | with open(self.adt_britney, 'w') as f: | ||
342 | 160 | f.write('''#!/bin/sh -e | ||
343 | 161 | echo "$@" >> /%s/adt-britney.log ''' % self.data.path) | ||
344 | 162 | os.chmod(self.adt_britney, 0o755) | ||
345 | 163 | |||
346 | 164 | def tearDown(self): | ||
347 | 165 | del self.data | ||
348 | 166 | |||
349 | 167 | def __merge_records(self, results, history=""): | 56 | def __merge_records(self, results, history=""): |
350 | 168 | '''Merges a list of results with records in history. | 57 | '''Merges a list of results with records in history. |
351 | 169 | 58 | ||
352 | @@ -235,28 +124,29 @@ | |||
353 | 235 | 'rq': request, | 124 | 'rq': request, |
354 | 236 | 'res': self.__merge_records(request, history)}) | 125 | 'res': self.__merge_records(request, history)}) |
355 | 237 | 126 | ||
378 | 238 | def run_britney(self, args=[]): | 127 | def do_test(self, unstable_add, adt_request, considered, expect=None, |
379 | 239 | '''Run britney. | 128 | no_expect=None, history=""): |
380 | 240 | 129 | for (pkg, fields) in unstable_add: | |
381 | 241 | Assert that it succeeds and does not produce anything on stderr. | 130 | self.data.add(pkg, True, fields) |
382 | 242 | Return (excuses.html, britney_out). | 131 | |
383 | 243 | ''' | 132 | self.make_adt_britney(adt_request, history) |
384 | 244 | britney = subprocess.Popen([self.britney, '-v', '-c', self.britney_conf, | 133 | |
385 | 245 | '--distribution=ubuntu', | 134 | (excuses, out) = self.run_britney() |
386 | 246 | '--series=%s' % self.data.series], | 135 | #print('-------\nexcuses: %s\n-----' % excuses) |
387 | 247 | stdout=subprocess.PIPE, | 136 | #print('-------\nout: %s\n-----' % out) |
388 | 248 | stderr=subprocess.PIPE, | 137 | #print('run:\n%s -c %s\n' % (self.britney, self.britney_conf)) |
389 | 249 | cwd=self.data.path, | 138 | #subprocess.call(['bash', '-i'], cwd=self.data.path) |
390 | 250 | universal_newlines=True) | 139 | if considered: |
391 | 251 | (out, err) = britney.communicate() | 140 | self.assertIn('Valid candidate', excuses) |
392 | 252 | self.assertEqual(britney.returncode, 0, out + err) | 141 | else: |
393 | 253 | self.assertEqual(err, '') | 142 | self.assertIn('Not considered', excuses) |
394 | 254 | 143 | ||
395 | 255 | with open(os.path.join(self.data.path, 'output', self.data.series, | 144 | if expect: |
396 | 256 | 'excuses.html')) as f: | 145 | for re in expect: |
397 | 257 | excuses = f.read() | 146 | self.assertRegexpMatches(excuses, re) |
398 | 258 | 147 | if no_expect: | |
399 | 259 | return (excuses, out) | 148 | for re in no_expect: |
400 | 149 | self.assertNotRegexpMatches(excuses, re) | ||
401 | 260 | 150 | ||
402 | 261 | def test_no_request_for_uninstallable(self): | 151 | def test_no_request_for_uninstallable(self): |
403 | 262 | '''Does not request a test for an uninstallable package''' | 152 | '''Does not request a test for an uninstallable package''' |
404 | @@ -557,30 +447,6 @@ | |||
405 | 557 | history="lightgreen 1 PASS lightgreen 1" | 447 | history="lightgreen 1 PASS lightgreen 1" |
406 | 558 | ) | 448 | ) |
407 | 559 | 449 | ||
408 | 560 | def do_test(self, unstable_add, adt_request, considered, expect=None, | ||
409 | 561 | no_expect=None, history=""): | ||
410 | 562 | for (pkg, fields) in unstable_add: | ||
411 | 563 | self.data.add(pkg, True, fields) | ||
412 | 564 | |||
413 | 565 | self.make_adt_britney(adt_request, history) | ||
414 | 566 | |||
415 | 567 | (excuses, out) = self.run_britney() | ||
416 | 568 | #print('-------\nexcuses: %s\n-----' % excuses) | ||
417 | 569 | #print('-------\nout: %s\n-----' % out) | ||
418 | 570 | #print('run:\n%s -c %s\n' % (self.britney, self.britney_conf)) | ||
419 | 571 | #subprocess.call(['bash', '-i'], cwd=self.data.path) | ||
420 | 572 | if considered: | ||
421 | 573 | self.assertIn('Valid candidate', excuses) | ||
422 | 574 | else: | ||
423 | 575 | self.assertIn('Not considered', excuses) | ||
424 | 576 | |||
425 | 577 | if expect: | ||
426 | 578 | for re in expect: | ||
427 | 579 | self.assertRegexpMatches(excuses, re) | ||
428 | 580 | if no_expect: | ||
429 | 581 | for re in no_expect: | ||
430 | 582 | self.assertNotRegexpMatches(excuses, re) | ||
431 | 583 | |||
432 | 584 | def shell(self): | 450 | def shell(self): |
433 | 585 | # uninstallable unstable version | 451 | # uninstallable unstable version |
434 | 586 | self.data.add('yellow', True, {'Version': '1.1~beta', | 452 | self.data.add('yellow', True, {'Version': '1.1~beta', |
435 | @@ -593,4 +459,5 @@ | |||
436 | 593 | subprocess.call(['bash', '-i'], cwd=self.data.path) | 459 | subprocess.call(['bash', '-i'], cwd=self.data.path) |
437 | 594 | 460 | ||
438 | 595 | 461 | ||
440 | 596 | unittest.main() | 462 | if __name__ == '__main__': |
441 | 463 | unittest.main() |