Merge lp:~jelmer/bzr-builddeb/deprecation-warnings into lp:bzr-builddeb
- deprecation-warnings
- Merge into trunk
Proposed by
Jelmer Vernooij
Status: | Merged |
---|---|
Approved by: | James Westby |
Approved revision: | 568 |
Merged at revision: | 569 |
Proposed branch: | lp:~jelmer/bzr-builddeb/deprecation-warnings |
Merge into: | lp:bzr-builddeb |
Diff against target: |
1062 lines (+228/-186) 18 files modified
debian/changelog (+5/-1) tests/__init__.py (+25/-1) tests/blackbox/test_builddeb.py (+3/-3) tests/blackbox/test_do.py (+16/-8) tests/blackbox/test_merge_upstream.py (+1/-1) tests/test_builder.py (+9/-9) tests/test_bzrtools_import.py (+1/-2) tests/test_commit_message.py (+1/-2) tests/test_config.py (+1/-1) tests/test_dep3.py (+4/-1) tests/test_dh_make.py (+9/-9) tests/test_hooks.py (+7/-8) tests/test_merge_package.py (+2/-2) tests/test_repack_tarball.py (+16/-17) tests/test_repack_tarball_extra.py (+10/-10) tests/test_source_distiller.py (+49/-46) tests/test_upstream.py (+8/-6) tests/test_util.py (+61/-59) |
To merge this branch: | bzr merge lp:~jelmer/bzr-builddeb/deprecation-warnings |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Westby | Approve | ||
Review via email: mp+64472@code.launchpad.net |
Commit message
Description of the change
Fix deprecation warnings for TestCase.
To post a comment you must log in.
Revision history for this message
James Westby (james-w) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/changelog' |
2 | --- debian/changelog 2011-06-09 12:13:13 +0000 |
3 | +++ debian/changelog 2011-06-13 23:06:02 +0000 |
4 | @@ -8,7 +8,11 @@ |
5 | * Use new set_commit_message() hook in bzr to set the commit |
6 | message from debian/changelog and set fixed bugs in tags. LP: #707274 |
7 | |
8 | - -- Jonathan Riddell <jriddell@ubuntu.com> Fri, 03 Jun 2011 15:36:10 +0100 |
9 | + [ Jelmer Vernooij ] |
10 | + * Fix deprecation warnings for TestCase.failUnlessExists and |
11 | + TestCase.failIfExists in bzr 2.4. |
12 | + |
13 | + -- Jelmer Vernooij <jelmer@debian.org> Tue, 14 Jun 2011 00:02:40 +0100 |
14 | |
15 | bzr-builddeb (2.7.4) unstable; urgency=low |
16 | |
17 | |
18 | === modified file 'tests/__init__.py' |
19 | --- tests/__init__.py 2011-06-10 08:26:43 +0000 |
20 | +++ tests/__init__.py 2011-06-13 23:06:02 +0000 |
21 | @@ -28,13 +28,15 @@ |
22 | import os |
23 | from unittest import TestSuite |
24 | |
25 | +from bzrlib import tests |
26 | + |
27 | try: |
28 | from debian.changelog import Version, Changelog |
29 | except ImportError: |
30 | # Prior to 0.1.15 the debian module was called debian_bundle |
31 | from debian_bundle.changelog import Version, Changelog |
32 | |
33 | -from bzrlib.tests import TestUtil, multiply_tests, TestCaseWithTransport |
34 | +from bzrlib.tests import TestUtil, multiply_tests |
35 | |
36 | |
37 | def make_new_upstream_dir(source, dest): |
38 | @@ -158,6 +160,28 @@ |
39 | return suite |
40 | |
41 | |
42 | +class TestCaseWithTransport(tests.TestCaseWithTransport): |
43 | + |
44 | + if not getattr(tests.TestCaseWithTransport, "assertPathDoesNotExist", None): |
45 | + # Compatibility with bzr < 2.4 |
46 | + def assertPathDoesNotExist(self, path): |
47 | + self.failIfExists(path) |
48 | + |
49 | + def assertPathExists(self, path): |
50 | + self.failUnlessExists(path) |
51 | + |
52 | + |
53 | +class TestCaseInTempDir(tests.TestCaseInTempDir): |
54 | + |
55 | + if not getattr(tests.TestCaseInTempDir, "assertPathDoesNotExist", None): |
56 | + # Compatibility with bzr < 2.4 |
57 | + def assertPathDoesNotExist(self, path): |
58 | + self.failIfExists(path) |
59 | + |
60 | + def assertPathExists(self, path): |
61 | + self.failUnlessExists(path) |
62 | + |
63 | + |
64 | class BuilddebTestCase(TestCaseWithTransport): |
65 | |
66 | package_name = 'test' |
67 | |
68 | === modified file 'tests/blackbox/test_builddeb.py' |
69 | --- tests/blackbox/test_builddeb.py 2011-02-07 16:14:05 +0000 |
70 | +++ tests/blackbox/test_builddeb.py 2011-06-13 23:06:02 +0000 |
71 | @@ -50,14 +50,14 @@ |
72 | if isinstance(files, basestring): |
73 | files = [files] |
74 | for filename in files: |
75 | - self.failUnlessExists(os.path.join(build_dir, filename)) |
76 | + self.assertPathExists(os.path.join(build_dir, filename)) |
77 | |
78 | def assertNotInBuildDir(self, files): |
79 | build_dir = self.build_dir() |
80 | if isinstance(files, basestring): |
81 | files = [files] |
82 | for filename in files: |
83 | - self.failIfExists(os.path.join(build_dir, filename)) |
84 | + self.assertPathDoesNotExist(os.path.join(build_dir, filename)) |
85 | |
86 | def test_builddeb_registered(self): |
87 | self.run_bzr("builddeb --help") |
88 | @@ -163,7 +163,7 @@ |
89 | f.close() |
90 | self.run_bzr('add .bzr-builddeb/default.conf') |
91 | self.run_bzr('bd --dont-purge --builder true') |
92 | - self.failUnlessExists('pre-export') |
93 | + self.assertPathExists('pre-export') |
94 | self.assertInBuildDir(['pre-build', 'post-build']) |
95 | |
96 | # vim: ts=2 sts=2 sw=2 |
97 | |
98 | === modified file 'tests/blackbox/test_do.py' |
99 | --- tests/blackbox/test_do.py 2011-03-01 12:17:42 +0000 |
100 | +++ tests/blackbox/test_do.py 2011-06-13 23:06:02 +0000 |
101 | @@ -44,6 +44,14 @@ |
102 | uncommited_file = 'uncommited_file' |
103 | unadded_file = 'unadded_file' |
104 | |
105 | + if not getattr(ExternalBase, "assertPathDoesNotExist", None): |
106 | + # Compatibility with bzr < 2.4 |
107 | + def assertPathDoesNotExist(self, path): |
108 | + self.failIfExists(path) |
109 | + |
110 | + def assertPathExists(self, path): |
111 | + self.failUnlessExists(path) |
112 | + |
113 | def make_changelog(self, version=None): |
114 | if version is None: |
115 | version = self.package_version |
116 | @@ -101,12 +109,12 @@ |
117 | def assertInBuildDir(self, files): |
118 | build_dir = self.build_dir() |
119 | for filename in files: |
120 | - self.failUnlessExists(os.path.join(build_dir, filename)) |
121 | + self.assertPathExists(os.path.join(build_dir, filename)) |
122 | |
123 | def assertNotInBuildDir(self, files): |
124 | build_dir = self.build_dir() |
125 | for filename in files: |
126 | - self.failIfExists(os.path.join(build_dir, filename)) |
127 | + self.assertPathDoesNotExist(os.path.join(build_dir, filename)) |
128 | |
129 | def test_bd_do_registered(self): |
130 | self.run_bzr("bd-do --help") |
131 | @@ -127,14 +135,14 @@ |
132 | self.make_upstream_tarball() |
133 | self.run_bzr_error(['Not updating the working tree as the command ' |
134 | 'failed.'], ['bd-do', 'touch debian/do && false']) |
135 | - self.failIfExists('debian/do') |
136 | + self.assertPathDoesNotExist('debian/do') |
137 | |
138 | def test_copy_on_success(self): |
139 | tree = self.make_unpacked_source() |
140 | self.make_merge_mode_config(tree) |
141 | self.make_upstream_tarball() |
142 | self.run_bzr(['bd-do', 'touch debian/do']) |
143 | - self.failUnlessExists('debian/do') |
144 | + self.assertPathExists('debian/do') |
145 | |
146 | def test_removed_files_are_removed_in_branch(self): |
147 | tree = self.make_unpacked_source() |
148 | @@ -144,14 +152,14 @@ |
149 | # It might be nice if this was actually gone, but that would involve |
150 | # either a comaparison, or removing all the files, but the latter is |
151 | # dangerous. I guess it's a TODO to implement the comparison. |
152 | - self.failUnlessExists('debian/changelog') |
153 | + self.assertPathExists('debian/changelog') |
154 | |
155 | def test_new_directories_created(self): |
156 | tree = self.make_unpacked_source() |
157 | self.make_merge_mode_config(tree) |
158 | self.make_upstream_tarball() |
159 | self.run_bzr(['bd-do', 'mkdir debian/dir']) |
160 | - self.failUnlessExists('debian/dir') |
161 | + self.assertPathExists('debian/dir') |
162 | |
163 | def test_contents_taken_from_export(self): |
164 | tree = self.make_unpacked_source() |
165 | @@ -165,7 +173,7 @@ |
166 | self.make_merge_mode_config(tree) |
167 | self.make_upstream_tarball() |
168 | self.run_bzr(['bd-do', 'echo a > debian/changelog']) |
169 | - self.failIfExists(self.build_dir()) |
170 | + self.assertPathDoesNotExist(self.build_dir()) |
171 | |
172 | def test_uses_shell(self): |
173 | tree = self.make_unpacked_source() |
174 | @@ -180,6 +188,6 @@ |
175 | os.environ['SHELL'] = old_shell |
176 | else: |
177 | del os.environ['SHELL'] |
178 | - self.failUnlessExists('debian/shell') |
179 | + self.assertPathExists('debian/shell') |
180 | |
181 | # vim: ts=2 sts=2 sw=2 |
182 | |
183 | === modified file 'tests/blackbox/test_merge_upstream.py' |
184 | --- tests/blackbox/test_merge_upstream.py 2011-04-29 12:54:58 +0000 |
185 | +++ tests/blackbox/test_merge_upstream.py 2011-06-13 23:06:02 +0000 |
186 | @@ -196,7 +196,7 @@ |
187 | rel2 = self.release_upstream(changed_upstream) |
188 | self.run_bzr(['merge-upstream', '--version', str(rel2.version), |
189 | os.path.abspath(rel2.tarball)], working_dir=package.tree.basedir) |
190 | - self.failUnlessExists(os.path.join(package.tree.basedir, 'muhook')) |
191 | + self.assertPathExists(os.path.join(package.tree.basedir, 'muhook')) |
192 | |
193 | def test_new_package(self): |
194 | upstream = self.make_upstream() |
195 | |
196 | === modified file 'tests/test_builder.py' |
197 | --- tests/test_builder.py 2009-02-20 17:55:08 +0000 |
198 | +++ tests/test_builder.py 2011-06-13 23:06:02 +0000 |
199 | @@ -32,27 +32,27 @@ |
200 | def test_prepare_makes_parents(self): |
201 | builder = DebBuild(None, 'target/sub/sub2', None) |
202 | builder.prepare() |
203 | - self.failUnlessExists('target/sub') |
204 | - self.failIfExists('target/sub/sub2') |
205 | + self.assertPathExists('target/sub') |
206 | + self.assertPathDoesNotExist('target/sub/sub2') |
207 | |
208 | def test_prepare_purges_dir(self): |
209 | self.build_tree(['target/', 'target/sub/']) |
210 | builder = DebBuild(None, 'target/sub/', None) |
211 | builder.prepare() |
212 | - self.failUnlessExists('target') |
213 | - self.failIfExists('target/sub') |
214 | + self.assertPathExists('target') |
215 | + self.assertPathDoesNotExist('target/sub') |
216 | |
217 | def test_use_existing_preserves(self): |
218 | self.build_tree(['target/', 'target/sub/']) |
219 | builder = DebBuild(None, 'target/sub/', None, use_existing=True) |
220 | builder.prepare() |
221 | - self.failUnlessExists('target/sub') |
222 | + self.assertPathExists('target/sub') |
223 | |
224 | def test_use_existing_errors_if_not_present(self): |
225 | self.build_tree(['target/']) |
226 | builder = DebBuild(None, 'target/sub/', None, use_existing=True) |
227 | self.assertRaises(errors.NoSourceDirError, builder.prepare) |
228 | - self.failIfExists('target/sub') |
229 | + self.assertPathDoesNotExist('target/sub') |
230 | |
231 | def test_export(self): |
232 | class MkdirDistiller(object): |
233 | @@ -60,13 +60,13 @@ |
234 | os.mkdir(target) |
235 | builder = DebBuild(MkdirDistiller(), 'target', None) |
236 | builder.export() |
237 | - self.failUnlessExists('target') |
238 | + self.assertPathExists('target') |
239 | |
240 | def test_build(self): |
241 | builder = DebBuild(None, 'target', "touch built") |
242 | self.build_tree(['target/']) |
243 | builder.build() |
244 | - self.failUnlessExists('target/built') |
245 | + self.assertPathExists('target/built') |
246 | |
247 | def test_build_fails(self): |
248 | builder = DebBuild(None, 'target', "false") |
249 | @@ -77,4 +77,4 @@ |
250 | builder = DebBuild(None, 'target', None) |
251 | self.build_tree(['target/', 'target/foo']) |
252 | builder.clean() |
253 | - self.failIfExists('target') |
254 | + self.assertPathDoesNotExist('target') |
255 | |
256 | === modified file 'tests/test_bzrtools_import.py' |
257 | --- tests/test_bzrtools_import.py 2010-09-10 02:37:09 +0000 |
258 | +++ tests/test_bzrtools_import.py 2011-06-13 23:06:02 +0000 |
259 | @@ -18,9 +18,8 @@ |
260 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
261 | # |
262 | |
263 | -from bzrlib.tests import TestCaseWithTransport |
264 | - |
265 | from bzrlib.plugins.builddeb.bzrtools_import import import_dir |
266 | +from bzrlib.plugins.builddeb.tests import TestCaseWithTransport |
267 | |
268 | |
269 | class ImportArchiveTests(TestCaseWithTransport): |
270 | |
271 | === modified file 'tests/test_commit_message.py' |
272 | --- tests/test_commit_message.py 2011-06-03 14:39:17 +0000 |
273 | +++ tests/test_commit_message.py 2011-06-13 23:06:02 +0000 |
274 | @@ -17,9 +17,8 @@ |
275 | # along with bzr-builddeb; if not, write to the Free Software |
276 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
277 | |
278 | -from bzrlib.tests import TestCaseWithTransport |
279 | - |
280 | from bzrlib.plugins.builddeb import debian_changelog_commit_message, debian_changelog_commit |
281 | +from bzrlib.plugins.builddeb.tests import TestCaseWithTransport |
282 | |
283 | |
284 | class CommitMessageTests(TestCaseWithTransport): |
285 | |
286 | === modified file 'tests/test_config.py' |
287 | --- tests/test_config.py 2011-02-03 22:45:27 +0000 |
288 | +++ tests/test_config.py 2011-06-13 23:06:02 +0000 |
289 | @@ -19,13 +19,13 @@ |
290 | # |
291 | |
292 | from bzrlib.branch import Branch |
293 | -from bzrlib.tests import TestCaseWithTransport |
294 | |
295 | from bzrlib.plugins.builddeb.config import ( |
296 | BUILD_TYPE_MERGE, |
297 | BUILD_TYPE_NORMAL, |
298 | DebBuildConfig, |
299 | ) |
300 | +from bzrlib.plugins.builddeb.tests import TestCaseWithTransport |
301 | |
302 | |
303 | class DebBuildConfigTests(TestCaseWithTransport): |
304 | |
305 | === modified file 'tests/test_dep3.py' |
306 | --- tests/test_dep3.py 2011-05-08 10:15:28 +0000 |
307 | +++ tests/test_dep3.py 2011-06-13 23:06:02 +0000 |
308 | @@ -27,7 +27,6 @@ |
309 | ) |
310 | from bzrlib.tests import ( |
311 | TestCase, |
312 | - TestCaseWithTransport, |
313 | ) |
314 | |
315 | from bzrlib.plugins.builddeb.dep3 import ( |
316 | @@ -39,6 +38,10 @@ |
317 | write_dep3_patch_header, |
318 | ) |
319 | |
320 | +from bzrlib.plugins.builddeb.tests import ( |
321 | + TestCaseWithTransport, |
322 | + ) |
323 | + |
324 | |
325 | class Dep3HeaderTests(TestCase): |
326 | |
327 | |
328 | === modified file 'tests/test_dh_make.py' |
329 | --- tests/test_dh_make.py 2010-02-09 20:06:07 +0000 |
330 | +++ tests/test_dh_make.py 2011-06-13 23:06:02 +0000 |
331 | @@ -9,12 +9,12 @@ |
332 | def test__get_tree_existing_branch(self): |
333 | tree = self.make_branch_and_tree('.') |
334 | new_tree = dh_make._get_tree("foo") |
335 | - self.failIfExists("foo") |
336 | + self.assertPathDoesNotExist("foo") |
337 | self.assertEqual(tree.branch.base, new_tree.branch.base) |
338 | |
339 | def test__get_tree_no_existing_branch(self): |
340 | new_tree = dh_make._get_tree("foo") |
341 | - self.failUnlessExists("foo") |
342 | + self.assertPathExists("foo") |
343 | |
344 | def test_import_upstream(self): |
345 | tree = self.make_branch_and_tree('.') |
346 | @@ -34,10 +34,10 @@ |
347 | tree.branch.last_revision()) |
348 | # Has the original revision as a parent |
349 | self.assertEqual([revid], rev_tree.get_parent_ids()) |
350 | - self.failUnlessExists('a') |
351 | - self.failUnlessExists('b') |
352 | + self.assertPathExists('a') |
353 | + self.assertPathExists('b') |
354 | self.assertEqual(open('package-0.1/a').read(), open('a').read()) |
355 | - self.failUnlessExists('../package_0.1.orig.tar.gz') |
356 | + self.assertPathExists('../package_0.1.orig.tar.gz') |
357 | |
358 | def test_import_upstream_no_existing(self): |
359 | self.build_tree(['package-0.1/', 'package-0.1/a', 'package-0.1/b']) |
360 | @@ -47,12 +47,12 @@ |
361 | finally: |
362 | tf.close() |
363 | tree = dh_make.import_upstream('package-0.1', 'package', '0.1') |
364 | - self.failUnlessExists("package") |
365 | + self.assertPathExists("package") |
366 | rev_tree = tree.branch.repository.revision_tree( |
367 | tree.branch.last_revision()) |
368 | # Has the original revision as a parent |
369 | - self.failUnlessExists('package/a') |
370 | - self.failUnlessExists('package/b') |
371 | + self.assertPathExists('package/a') |
372 | + self.assertPathExists('package/b') |
373 | self.assertEqual(open('package-0.1/a').read(), |
374 | open('package/a').read()) |
375 | - self.failUnlessExists('package_0.1.orig.tar.gz') |
376 | + self.assertPathExists('package_0.1.orig.tar.gz') |
377 | |
378 | === modified file 'tests/test_hooks.py' |
379 | --- tests/test_hooks.py 2008-05-18 00:04:21 +0000 |
380 | +++ tests/test_hooks.py 2011-06-13 23:06:02 +0000 |
381 | @@ -20,11 +20,10 @@ |
382 | |
383 | import os |
384 | |
385 | -from bzrlib.tests import TestCaseInTempDir |
386 | - |
387 | from bzrlib.plugins.builddeb.config import DebBuildConfig |
388 | from bzrlib.plugins.builddeb.errors import HookFailedError |
389 | from bzrlib.plugins.builddeb.hooks import run_hook |
390 | +from bzrlib.plugins.builddeb.tests import TestCaseInTempDir |
391 | |
392 | class MockTree: |
393 | def abspath(self, relpath): |
394 | @@ -67,7 +66,7 @@ |
395 | f.close() |
396 | config = DebBuildConfig([(self.default_conf, False)]) |
397 | run_hook(MockTree(), 'pre-build', config) |
398 | - self.failUnlessExists('a') |
399 | + self.assertPathExists('a') |
400 | |
401 | def test_run_hook_uses_passed_wd(self): |
402 | os.mkdir('dir') |
403 | @@ -78,7 +77,7 @@ |
404 | f.close() |
405 | config = DebBuildConfig([(self.default_conf, False)]) |
406 | run_hook(MockTree(), 'pre-build', config, wd='dir') |
407 | - self.failUnlessExists('dir/a') |
408 | + self.assertPathExists('dir/a') |
409 | |
410 | def test_run_hook_uses_shell(self): |
411 | f = open(self.default_conf, 'wb') |
412 | @@ -88,8 +87,8 @@ |
413 | f.close() |
414 | config = DebBuildConfig([(self.default_conf, False)]) |
415 | run_hook(MockTree(), 'post-build', config) |
416 | - self.failUnlessExists('a') |
417 | - self.failUnlessExists('b') |
418 | + self.assertPathExists('a') |
419 | + self.assertPathExists('b') |
420 | |
421 | def test_run_hook_uses_local_over_global(self): |
422 | f = open(self.default_conf, 'wb') |
423 | @@ -105,7 +104,7 @@ |
424 | config = DebBuildConfig([(self.local_conf, False), |
425 | (self.default_conf, False)]) |
426 | run_hook(MockTree(), 'post-build', config) |
427 | - self.failIfExists('a') |
428 | - self.failUnlessExists('b') |
429 | + self.assertPathDoesNotExist('a') |
430 | + self.assertPathExists('b') |
431 | |
432 | # vim: ts=2 sts=2 sw=2 |
433 | |
434 | === modified file 'tests/test_merge_package.py' |
435 | --- tests/test_merge_package.py 2010-08-19 07:14:39 +0000 |
436 | +++ tests/test_merge_package.py 2011-06-13 23:06:02 +0000 |
437 | @@ -28,13 +28,13 @@ |
438 | # Prior to 0.1.15 the debian module was called debian_bundle |
439 | from debian_bundle.changelog import Version |
440 | |
441 | -from bzrlib.tests import TestCaseWithTransport |
442 | - |
443 | from bzrlib.plugins.builddeb import merge_package as MP |
444 | from bzrlib.plugins.builddeb.errors import ( |
445 | SharedUpstreamConflictsWithTargetPackaging) |
446 | from bzrlib.plugins.builddeb.import_dsc import DistributionBranch |
447 | |
448 | +from bzrlib.plugins.builddeb.tests import TestCaseWithTransport |
449 | + |
450 | _Debian_changelog = '''\ |
451 | ipsec-tools (%s) unstable; urgency=high |
452 | |
453 | |
454 | === modified file 'tests/test_repack_tarball.py' |
455 | --- tests/test_repack_tarball.py 2011-02-27 10:38:10 +0000 |
456 | +++ tests/test_repack_tarball.py 2011-06-13 23:06:02 +0000 |
457 | @@ -24,13 +24,12 @@ |
458 | from bzrlib.errors import (NoSuchFile, |
459 | FileExists, |
460 | ) |
461 | -from bzrlib.tests import TestCaseInTempDir |
462 | - |
463 | from bzrlib.plugins.builddeb.errors import UnsupportedRepackFormat |
464 | from bzrlib.plugins.builddeb.repack_tarball import ( |
465 | repack_tarball, |
466 | get_repacker_class, |
467 | ) |
468 | +from bzrlib.plugins.builddeb.tests import TestCaseInTempDir |
469 | |
470 | |
471 | def touch(filename): |
472 | @@ -66,7 +65,7 @@ |
473 | |
474 | def test_create_old_tarball(self): |
475 | self.create_old_tarball() |
476 | - self.failUnlessExists(self.old_tarball) |
477 | + self.assertPathExists(self.old_tarball) |
478 | |
479 | def test_repack_tarball_non_extant(self): |
480 | error = NoSuchFile |
481 | @@ -86,8 +85,8 @@ |
482 | def test_repack_tarball_creates_new(self): |
483 | self.create_old_tarball() |
484 | repack_tarball(self.old_tarball, self.new_tarball) |
485 | - self.failUnlessExists(self.old_tarball) |
486 | - self.failUnlessExists(self.new_tarball) |
487 | + self.assertPathExists(self.old_tarball) |
488 | + self.assertPathExists(self.new_tarball) |
489 | |
490 | def test_repack_tarball_contents(self): |
491 | self.create_old_tarball() |
492 | @@ -107,20 +106,20 @@ |
493 | self.create_old_tarball() |
494 | target_dir = 'tarballs' |
495 | repack_tarball(self.old_tarball, self.new_tarball, target_dir=target_dir) |
496 | - self.failUnlessExists(target_dir) |
497 | - self.failUnlessExists(os.path.join(target_dir, self.new_tarball)) |
498 | - self.failUnlessExists(self.old_tarball) |
499 | - self.failIfExists(self.new_tarball) |
500 | + self.assertPathExists(target_dir) |
501 | + self.assertPathExists(os.path.join(target_dir, self.new_tarball)) |
502 | + self.assertPathExists(self.old_tarball) |
503 | + self.assertPathDoesNotExist(self.new_tarball) |
504 | |
505 | def test_repack_tarball_with_target_dir_exists(self): |
506 | self.create_old_tarball() |
507 | target_dir = 'tarballs' |
508 | os.mkdir(target_dir) |
509 | repack_tarball(self.old_tarball, self.new_tarball, target_dir=target_dir) |
510 | - self.failUnlessExists(target_dir) |
511 | - self.failUnlessExists(os.path.join(target_dir, self.new_tarball)) |
512 | - self.failUnlessExists(self.old_tarball) |
513 | - self.failIfExists(self.new_tarball) |
514 | + self.assertPathExists(target_dir) |
515 | + self.assertPathExists(os.path.join(target_dir, self.new_tarball)) |
516 | + self.assertPathExists(self.old_tarball) |
517 | + self.assertPathDoesNotExist(self.new_tarball) |
518 | |
519 | def test_repack_tarball_with_target_dir_not_dir(self): |
520 | self.create_old_tarball() |
521 | @@ -129,7 +128,7 @@ |
522 | # transport gives NoSuchFile rather than NotADirectory for this |
523 | self.assertRaises(NoSuchFile, repack_tarball, self.old_tarball, |
524 | self.new_tarball, target_dir=target_dir) |
525 | - self.failUnlessExists(self.old_tarball) |
526 | - self.failIfExists(self.new_tarball) |
527 | - self.failIfExists(os.path.join(target_dir, self.new_tarball)) |
528 | - self.failUnlessExists(target_dir) |
529 | + self.assertPathExists(self.old_tarball) |
530 | + self.assertPathDoesNotExist(self.new_tarball) |
531 | + self.assertPathDoesNotExist(os.path.join(target_dir, self.new_tarball)) |
532 | + self.assertPathExists(target_dir) |
533 | |
534 | === modified file 'tests/test_repack_tarball_extra.py' |
535 | --- tests/test_repack_tarball_extra.py 2010-08-19 00:15:35 +0000 |
536 | +++ tests/test_repack_tarball_extra.py 2011-06-13 23:06:02 +0000 |
537 | @@ -72,7 +72,7 @@ |
538 | old_tarball = 'package-0.2.INVALID' |
539 | f = open(old_tarball, 'w') |
540 | f.close() |
541 | - self.failUnlessExists(old_tarball) |
542 | + self.assertPathExists(old_tarball) |
543 | self.assertRaises(UnsupportedRepackFormat, repack_tarball, old_tarball, |
544 | 'package_0.2.orig.tar.gz') |
545 | |
546 | @@ -86,8 +86,8 @@ |
547 | make_new_upstream_tarball(os.path.join(target_dir, tarball_name)) |
548 | self.assertRaises(FileExists, repack_tarball, tarball_name, |
549 | tarball_name, target_dir=target_dir) |
550 | - self.failUnlessExists(tarball_name) |
551 | - self.failUnlessExists(os.path.join(target_dir, tarball_name)) |
552 | + self.assertPathExists(tarball_name) |
553 | + self.assertPathExists(os.path.join(target_dir, tarball_name)) |
554 | |
555 | def test_conditional_repack_tarball_same(self): |
556 | tarball_name = 'package-0.2.tar.gz' |
557 | @@ -97,8 +97,8 @@ |
558 | os.mkdir(target_dir) |
559 | shutil.copy(tarball_name, target_dir) |
560 | repack_tarball(tarball_name, tarball_name, target_dir=target_dir) |
561 | - self.failUnlessExists(tarball_name) |
562 | - self.failUnlessExists(os.path.join(target_dir, tarball_name)) |
563 | + self.assertPathExists(tarball_name) |
564 | + self.assertPathExists(os.path.join(target_dir, tarball_name)) |
565 | |
566 | def test_conditional_repack_different_formats(self): |
567 | tarball_name = 'package-0.2.tar.gz' |
568 | @@ -111,8 +111,8 @@ |
569 | make_new_upstream_tarball(os.path.join(target_dir, tarball_name)) |
570 | self.assertRaises(FileExists, repack_tarball, bz2_tarball_name, |
571 | tarball_name, target_dir=target_dir) |
572 | - self.failUnlessExists(bz2_tarball_name) |
573 | - self.failUnlessExists(os.path.join(target_dir, tarball_name)) |
574 | + self.assertPathExists(bz2_tarball_name) |
575 | + self.assertPathExists(os.path.join(target_dir, tarball_name)) |
576 | |
577 | def test_exists_not_force_gz(self): |
578 | bz2_tarball_name = 'package-0.2.tar.bz2' |
579 | @@ -120,7 +120,7 @@ |
580 | make_new_upstream_tarball_bz2(bz2_tarball_name) |
581 | repack_tarball(bz2_tarball_name, bz2_tarball_name, target_dir=".", |
582 | force_gz=False) |
583 | - self.failUnlessExists(bz2_tarball_name) |
584 | + self.assertPathExists(bz2_tarball_name) |
585 | |
586 | def test_exists_different_bz2(self): |
587 | bz2_tarball_name = 'package-0.2.tar.bz2' |
588 | @@ -132,5 +132,5 @@ |
589 | make_new_upstream_tarball(os.path.join(target_dir, bz2_tarball_name)) |
590 | self.assertRaises(FileExists, repack_tarball, bz2_tarball_name, |
591 | bz2_tarball_name, target_dir=target_dir) |
592 | - self.failUnlessExists(bz2_tarball_name) |
593 | - self.failUnlessExists(os.path.join(target_dir, bz2_tarball_name)) |
594 | + self.assertPathExists(bz2_tarball_name) |
595 | + self.assertPathExists(os.path.join(target_dir, bz2_tarball_name)) |
596 | |
597 | === modified file 'tests/test_source_distiller.py' |
598 | --- tests/test_source_distiller.py 2011-01-24 05:46:47 +0000 |
599 | +++ tests/test_source_distiller.py 2011-06-13 23:06:02 +0000 |
600 | @@ -26,22 +26,24 @@ |
601 | from debian_bundle.changelog import Version |
602 | |
603 | from bzrlib.errors import ( |
604 | - FileExists, |
605 | - ) |
606 | -from bzrlib.tests import TestCaseWithTransport |
607 | + FileExists, |
608 | + ) |
609 | |
610 | from bzrlib.plugins.builddeb.errors import MissingUpstreamTarball |
611 | from bzrlib.plugins.builddeb.source_distiller import ( |
612 | - FullSourceDistiller, |
613 | - MergeModeDistiller, |
614 | - NativeSourceDistiller, |
615 | - ) |
616 | -from bzrlib.plugins.builddeb.tests import SourcePackageBuilder |
617 | + FullSourceDistiller, |
618 | + MergeModeDistiller, |
619 | + NativeSourceDistiller, |
620 | + ) |
621 | +from bzrlib.plugins.builddeb.tests import ( |
622 | + SourcePackageBuilder, |
623 | + TestCaseWithTransport, |
624 | + ) |
625 | from bzrlib.plugins.builddeb.tests.test_upstream import ( |
626 | - _MissingUpstreamProvider, |
627 | - _SimpleUpstreamProvider, |
628 | - _TouchUpstreamProvider, |
629 | - ) |
630 | + _MissingUpstreamProvider, |
631 | + _SimpleUpstreamProvider, |
632 | + _TouchUpstreamProvider, |
633 | + ) |
634 | |
635 | |
636 | class NativeSourceDistillerTests(TestCaseWithTransport): |
637 | @@ -64,8 +66,8 @@ |
638 | rev_tree = wt.basis_tree() |
639 | sd = NativeSourceDistiller(rev_tree, None) |
640 | sd.distill('target') |
641 | - self.failUnlessExists('target') |
642 | - self.failUnlessExists('target/a') |
643 | + self.assertPathExists('target') |
644 | + self.assertPathExists('target/a') |
645 | |
646 | def test_distill_removes_builddeb_dir(self): |
647 | wt = self.make_branch_and_tree(".") |
648 | @@ -79,9 +81,9 @@ |
649 | rev_tree = wt.basis_tree() |
650 | sd = NativeSourceDistiller(rev_tree, None) |
651 | sd.distill('target') |
652 | - self.failUnlessExists('target') |
653 | - self.failUnlessExists('target/a') |
654 | - self.failIfExists('target/.bzr-builddeb') |
655 | + self.assertPathExists('target') |
656 | + self.assertPathExists('target/a') |
657 | + self.assertPathDoesNotExist('target/.bzr-builddeb') |
658 | |
659 | def test_distill_working_tree_with_symlinks(self): |
660 | wt = self.make_branch_and_tree(".") |
661 | @@ -92,9 +94,9 @@ |
662 | wt.add(['a', 'b']) |
663 | sd = NativeSourceDistiller(wt, None, is_working_tree=True) |
664 | sd.distill('target') |
665 | - self.failUnlessExists('target') |
666 | - self.failUnlessExists('target/a') |
667 | - self.failUnlessExists('target/b') |
668 | + self.assertPathExists('target') |
669 | + self.assertPathExists('target/a') |
670 | + self.assertPathExists('target/b') |
671 | |
672 | |
673 | class FullSourceDistillerTests(TestCaseWithTransport): |
674 | @@ -120,7 +122,7 @@ |
675 | self.addCleanup(wt.unlock) |
676 | sd = FullSourceDistiller(wt, _TouchUpstreamProvider('tarball')) |
677 | sd.distill('target') |
678 | - self.failUnlessExists('tarball') |
679 | + self.assertPathExists('tarball') |
680 | |
681 | def test_distill_revision_tree(self): |
682 | wt = self.make_branch_and_tree(".") |
683 | @@ -130,10 +132,10 @@ |
684 | wt.add(['a', '.bzr-builddeb']) |
685 | sd = FullSourceDistiller(wt, _TouchUpstreamProvider('tarball')) |
686 | sd.distill('target') |
687 | - self.failUnlessExists('tarball') |
688 | - self.failUnlessExists('target') |
689 | - self.failUnlessExists('target/a') |
690 | - self.failIfExists('target/.bzr-builddeb') |
691 | + self.assertPathExists('tarball') |
692 | + self.assertPathExists('target') |
693 | + self.assertPathExists('target/a') |
694 | + self.assertPathDoesNotExist('target/.bzr-builddeb') |
695 | |
696 | def test_distill_working_tree_with_symlinks(self): |
697 | wt = self.make_branch_and_tree(".") |
698 | @@ -145,9 +147,10 @@ |
699 | sd = FullSourceDistiller(wt, _TouchUpstreamProvider('tarball'), |
700 | is_working_tree=True) |
701 | sd.distill('target') |
702 | - self.failUnlessExists('target') |
703 | - self.failUnlessExists('target/a') |
704 | - self.failUnlessExists('target/b') |
705 | + self.assertPathExists('target') |
706 | + self.assertPathExists('target/a') |
707 | + self.assertPathExists('target/b') |
708 | + |
709 | |
710 | class MergeModeDistillerTests(TestCaseWithTransport): |
711 | |
712 | @@ -183,9 +186,9 @@ |
713 | sd = MergeModeDistiller(wt, _SimpleUpstreamProvider(name, |
714 | version.upstream_version, ".")) |
715 | sd.distill('target/foo') |
716 | - self.failUnlessExists('target/%s_%s.orig.tar.gz' |
717 | + self.assertPathExists('target/%s_%s.orig.tar.gz' |
718 | % (name, version.upstream_version)) |
719 | - self.failUnlessExists('target/foo/a') |
720 | + self.assertPathExists('target/foo/a') |
721 | |
722 | def test_distill_exports_branch(self): |
723 | wt = self.make_branch_and_tree('.') |
724 | @@ -199,8 +202,8 @@ |
725 | sd = MergeModeDistiller(wt, _SimpleUpstreamProvider(name, |
726 | version.upstream_version, ".")) |
727 | sd.distill('target/') |
728 | - self.failUnlessExists('target/debian/a') |
729 | - self.failIfExists('target/.bzr-builddeb') |
730 | + self.assertPathExists('target/debian/a') |
731 | + self.assertPathDoesNotExist('target/.bzr-builddeb') |
732 | |
733 | def test_distill_removes_debian(self): |
734 | wt = self.make_branch_and_tree('.') |
735 | @@ -218,8 +221,8 @@ |
736 | sd = MergeModeDistiller(wt, _SimpleUpstreamProvider(name, |
737 | version.upstream_version, ".")) |
738 | sd.distill('target/') |
739 | - self.failUnlessExists('target/a') |
740 | - self.failIfExists('target/debian/foo') |
741 | + self.assertPathExists('target/a') |
742 | + self.assertPathDoesNotExist('target/debian/foo') |
743 | |
744 | def test_distill_larstiq(self): |
745 | wt = self.make_branch_and_tree('.') |
746 | @@ -233,11 +236,11 @@ |
747 | sd = MergeModeDistiller(wt, _SimpleUpstreamProvider(name, |
748 | version.upstream_version, "."), larstiq=True) |
749 | sd.distill('target/') |
750 | - self.failUnlessExists('target/a') |
751 | - self.failUnlessExists('target/debian/b') |
752 | - self.failIfExists('target/debian/.bzr-builddeb') |
753 | - self.failIfExists('target/.bzr-builddeb') |
754 | - self.failIfExists('target/b') |
755 | + self.assertPathExists('target/a') |
756 | + self.assertPathExists('target/debian/b') |
757 | + self.assertPathDoesNotExist('target/debian/.bzr-builddeb') |
758 | + self.assertPathDoesNotExist('target/.bzr-builddeb') |
759 | + self.assertPathDoesNotExist('target/b') |
760 | |
761 | def test_distill_use_existing(self): |
762 | wt = self.make_branch_and_tree('.') |
763 | @@ -253,10 +256,10 @@ |
764 | self.build_tree(['target/', 'target/b', 'target/debian/', |
765 | 'target/debian/b']) |
766 | sd.distill('target/') |
767 | - self.failUnlessExists('target/b') |
768 | - self.failUnlessExists('target/debian/a') |
769 | - self.failIfExists('target/a') |
770 | - self.failIfExists('target/debian/b') |
771 | + self.assertPathExists('target/b') |
772 | + self.assertPathExists('target/debian/a') |
773 | + self.assertPathDoesNotExist('target/a') |
774 | + self.assertPathDoesNotExist('target/debian/b') |
775 | |
776 | def test_distill_working_tree_with_symlinks(self): |
777 | wt = self.make_branch_and_tree(".") |
778 | @@ -271,6 +274,6 @@ |
779 | sd = MergeModeDistiller(wt, _SimpleUpstreamProvider(name, |
780 | version.upstream_version, "."), is_working_tree=True) |
781 | sd.distill('target') |
782 | - self.failUnlessExists('target') |
783 | - self.failUnlessExists('target/debian/a') |
784 | - self.failUnlessExists('target/debian/b') |
785 | + self.assertPathExists('target') |
786 | + self.assertPathExists('target/debian/a') |
787 | + self.assertPathExists('target/debian/b') |
788 | |
789 | === modified file 'tests/test_upstream.py' |
790 | --- tests/test_upstream.py 2011-06-03 12:17:42 +0000 |
791 | +++ tests/test_upstream.py 2011-06-13 23:06:02 +0000 |
792 | @@ -36,7 +36,6 @@ |
793 | from bzrlib.tests import ( |
794 | Feature, |
795 | TestCase, |
796 | - TestCaseWithTransport, |
797 | ) |
798 | from bzrlib.plugins.builddeb.config import ( |
799 | DebBuildConfig, |
800 | @@ -46,6 +45,9 @@ |
801 | PackageVersionNotPresent, |
802 | WatchFileMissing, |
803 | ) |
804 | +from bzrlib.plugins.builddeb.tests import ( |
805 | + TestCaseWithTransport, |
806 | + ) |
807 | from bzrlib.plugins.builddeb.upstream import ( |
808 | AptSource, |
809 | StackedUpstreamSource, |
810 | @@ -336,7 +338,7 @@ |
811 | os.mkdir("mydir") |
812 | self.assertEquals("mydir/foo_1.0.orig.tar.gz", |
813 | source.fetch_tarball("foo", "1.0", "mydir")) |
814 | - self.failUnlessExists("mydir/foo_1.0.orig.tar.gz") |
815 | + self.assertPathExists("mydir/foo_1.0.orig.tar.gz") |
816 | |
817 | def test_fetch_tarball_not_found(self): |
818 | source = UpstreamBranchSource(self.tree.branch) |
819 | @@ -402,7 +404,7 @@ |
820 | os.mkdir("mydir") |
821 | self.assertEquals("mydir/foo_1.0.orig.tar.gz", |
822 | source.fetch_tarball("foo", "1.0", "mydir")) |
823 | - self.failUnlessExists("mydir/foo_1.0.orig.tar.gz") |
824 | + self.assertPathExists("mydir/foo_1.0.orig.tar.gz") |
825 | self.assertIsNot(None, source._upstream_branch) |
826 | |
827 | def test_fetch_tarball_not_found(self): |
828 | @@ -680,7 +682,7 @@ |
829 | os.mkdir("bar") |
830 | self.assertEquals("bar/foo_1.0.orig.tar.gz", |
831 | source.fetch_tarball("foo", "1.0", "bar")) |
832 | - self.failUnlessExists("bar/foo_1.0.orig.tar.gz") |
833 | + self.assertPathExists("bar/foo_1.0.orig.tar.gz") |
834 | |
835 | def test_fetch_tarball_repack(self): |
836 | zf = zipfile.ZipFile("bla-2.0.zip", "w") |
837 | @@ -690,7 +692,7 @@ |
838 | os.mkdir("bar") |
839 | self.assertEquals("bar/foo_2.0.orig.tar.gz", |
840 | source.fetch_tarball("foo", "2.0", "bar")) |
841 | - self.failUnlessExists("bar/foo_2.0.orig.tar.gz") |
842 | + self.assertPathExists("bar/foo_2.0.orig.tar.gz") |
843 | |
844 | def test_fetch_tarball_not_present(self): |
845 | source = TarfileSource("foo-1.0.tar.gz", "1.0") |
846 | @@ -707,7 +709,7 @@ |
847 | os.mkdir("bar") |
848 | self.assertEquals("bar/foo_1.0.orig.tar.gz", |
849 | source.fetch_tarball("foo", "1.0", "bar")) |
850 | - self.failUnlessExists("bar/foo_1.0.orig.tar.gz") |
851 | + self.assertPathExists("bar/foo_1.0.orig.tar.gz") |
852 | gzip.open("bar/foo_1.0.orig.tar.gz").close() |
853 | |
854 | |
855 | |
856 | === modified file 'tests/test_util.py' |
857 | --- tests/test_util.py 2011-04-08 18:47:10 +0000 |
858 | +++ tests/test_util.py 2011-06-13 23:06:02 +0000 |
859 | @@ -38,39 +38,41 @@ |
860 | BUILD_TYPE_NORMAL, |
861 | ) |
862 | from bzrlib.plugins.builddeb.errors import (MissingChangelogError, |
863 | - AddChangelogError, |
864 | - InconsistentSourceFormatError, |
865 | - NoPreviousUpload, |
866 | - ) |
867 | -from bzrlib.plugins.builddeb.tests import SourcePackageBuilder |
868 | + AddChangelogError, |
869 | + InconsistentSourceFormatError, |
870 | + NoPreviousUpload, |
871 | + ) |
872 | +from bzrlib.plugins.builddeb.tests import ( |
873 | + SourcePackageBuilder, |
874 | + TestCaseInTempDir, |
875 | + TestCaseWithTransport, |
876 | + ) |
877 | from bzrlib.plugins.builddeb.util import ( |
878 | - dget, |
879 | - dget_changes, |
880 | - find_bugs_fixed, |
881 | - find_changelog, |
882 | - find_extra_authors, |
883 | - find_last_distribution, |
884 | - _find_previous_upload, |
885 | - find_thanks, |
886 | - get_commit_info_from_changelog, |
887 | - get_source_format, |
888 | - guess_build_type, |
889 | - lookup_distribution, |
890 | - move_file_if_different, |
891 | - get_parent_dir, |
892 | - recursive_copy, |
893 | - safe_decode, |
894 | - strip_changelog_message, |
895 | - suite_to_distribution, |
896 | - tarball_name, |
897 | - write_if_different, |
898 | - ) |
899 | + dget, |
900 | + dget_changes, |
901 | + find_bugs_fixed, |
902 | + find_changelog, |
903 | + find_extra_authors, |
904 | + find_last_distribution, |
905 | + _find_previous_upload, |
906 | + find_thanks, |
907 | + get_commit_info_from_changelog, |
908 | + get_source_format, |
909 | + guess_build_type, |
910 | + lookup_distribution, |
911 | + move_file_if_different, |
912 | + get_parent_dir, |
913 | + recursive_copy, |
914 | + safe_decode, |
915 | + strip_changelog_message, |
916 | + suite_to_distribution, |
917 | + tarball_name, |
918 | + write_if_different, |
919 | + ) |
920 | |
921 | from bzrlib import errors as bzr_errors |
922 | from bzrlib.tests import ( |
923 | SymlinkFeature, |
924 | - TestCaseWithTransport, |
925 | - TestCaseInTempDir, |
926 | TestCase, |
927 | ) |
928 | |
929 | @@ -90,15 +92,15 @@ |
930 | f.close() |
931 | os.mkdir('b/g') |
932 | recursive_copy('a', 'b') |
933 | - self.failUnlessExists('a') |
934 | - self.failUnlessExists('b') |
935 | - self.failUnlessExists('c') |
936 | - self.failUnlessExists('b/d') |
937 | - self.failUnlessExists('b/d/e') |
938 | - self.failUnlessExists('b/f') |
939 | - self.failUnlessExists('a/d') |
940 | - self.failUnlessExists('a/d/e') |
941 | - self.failUnlessExists('a/f') |
942 | + self.assertPathExists('a') |
943 | + self.assertPathExists('b') |
944 | + self.assertPathExists('c') |
945 | + self.assertPathExists('b/d') |
946 | + self.assertPathExists('b/d/e') |
947 | + self.assertPathExists('b/f') |
948 | + self.assertPathExists('a/d') |
949 | + self.assertPathExists('a/d/e') |
950 | + self.assertPathExists('a/f') |
951 | |
952 | |
953 | class SafeDecodeTests(TestCase): |
954 | @@ -325,13 +327,13 @@ |
955 | def test_move_file_non_extant(self): |
956 | self.build_tree(['a']) |
957 | move_file_if_different('a', 'b', None) |
958 | - self.failIfExists('a') |
959 | - self.failUnlessExists('b') |
960 | + self.assertPathDoesNotExist('a') |
961 | + self.assertPathExists('b') |
962 | |
963 | def test_move_file_samefile(self): |
964 | self.build_tree(['a']) |
965 | move_file_if_different('a', 'a', None) |
966 | - self.failUnlessExists('a') |
967 | + self.assertPathExists('a') |
968 | |
969 | def test_move_file_same_md5(self): |
970 | self.build_tree(['a']) |
971 | @@ -343,8 +345,8 @@ |
972 | f.close() |
973 | shutil.copy('a', 'b') |
974 | move_file_if_different('a', 'b', md5sum.hexdigest()) |
975 | - self.failUnlessExists('a') |
976 | - self.failUnlessExists('b') |
977 | + self.assertPathExists('a') |
978 | + self.assertPathExists('b') |
979 | |
980 | def test_move_file_diff_md5(self): |
981 | self.build_tree(['a', 'b']) |
982 | @@ -364,8 +366,8 @@ |
983 | b_hexdigest = md5sum.hexdigest() |
984 | self.assertNotEqual(a_hexdigest, b_hexdigest) |
985 | move_file_if_different('a', 'b', a_hexdigest) |
986 | - self.failIfExists('a') |
987 | - self.failUnlessExists('b') |
988 | + self.assertPathDoesNotExist('a') |
989 | + self.assertPathExists('b') |
990 | md5sum = md5.md5() |
991 | f = open('b', 'rb') |
992 | try: |
993 | @@ -379,23 +381,23 @@ |
994 | |
995 | def test_write_non_extant(self): |
996 | write_if_different("foo", 'a') |
997 | - self.failUnlessExists('a') |
998 | + self.assertPathExists('a') |
999 | self.check_file_contents('a', "foo") |
1000 | |
1001 | def test_write_file_same(self): |
1002 | write_if_different("foo", 'a') |
1003 | - self.failUnlessExists('a') |
1004 | + self.assertPathExists('a') |
1005 | self.check_file_contents('a', "foo") |
1006 | write_if_different("foo", 'a') |
1007 | - self.failUnlessExists('a') |
1008 | + self.assertPathExists('a') |
1009 | self.check_file_contents('a', "foo") |
1010 | |
1011 | def test_write_file_different(self): |
1012 | write_if_different("foo", 'a') |
1013 | - self.failUnlessExists('a') |
1014 | + self.assertPathExists('a') |
1015 | self.check_file_contents('a', "foo") |
1016 | write_if_different("bar", 'a') |
1017 | - self.failUnlessExists('a') |
1018 | + self.assertPathExists('a') |
1019 | self.check_file_contents('a', "bar") |
1020 | |
1021 | |
1022 | @@ -408,9 +410,9 @@ |
1023 | builder.build() |
1024 | self.build_tree(["target/"]) |
1025 | dget(builder.dsc_name(), 'target') |
1026 | - self.failUnlessExists(os.path.join("target", builder.dsc_name())) |
1027 | - self.failUnlessExists(os.path.join("target", builder.tar_name())) |
1028 | - self.failUnlessExists(os.path.join("target", builder.diff_name())) |
1029 | + self.assertPathExists(os.path.join("target", builder.dsc_name())) |
1030 | + self.assertPathExists(os.path.join("target", builder.tar_name())) |
1031 | + self.assertPathExists(os.path.join("target", builder.diff_name())) |
1032 | |
1033 | def test_dget_transport(self): |
1034 | builder = SourcePackageBuilder("package", Version("0.1-1")) |
1035 | @@ -419,9 +421,9 @@ |
1036 | builder.build() |
1037 | self.build_tree(["target/"]) |
1038 | dget(self.get_url(builder.dsc_name()), 'target') |
1039 | - self.failUnlessExists(os.path.join("target", builder.dsc_name())) |
1040 | - self.failUnlessExists(os.path.join("target", builder.tar_name())) |
1041 | - self.failUnlessExists(os.path.join("target", builder.diff_name())) |
1042 | + self.assertPathExists(os.path.join("target", builder.dsc_name())) |
1043 | + self.assertPathExists(os.path.join("target", builder.tar_name())) |
1044 | + self.assertPathExists(os.path.join("target", builder.diff_name())) |
1045 | |
1046 | def test_dget_missing_dsc(self): |
1047 | builder = SourcePackageBuilder("package", Version("0.1-1")) |
1048 | @@ -457,10 +459,10 @@ |
1049 | builder.build() |
1050 | self.build_tree(["target/"]) |
1051 | dget_changes(builder.changes_name(), 'target') |
1052 | - self.failUnlessExists(os.path.join("target", builder.dsc_name())) |
1053 | - self.failUnlessExists(os.path.join("target", builder.tar_name())) |
1054 | - self.failUnlessExists(os.path.join("target", builder.diff_name())) |
1055 | - self.failUnlessExists(os.path.join("target", builder.changes_name())) |
1056 | + self.assertPathExists(os.path.join("target", builder.dsc_name())) |
1057 | + self.assertPathExists(os.path.join("target", builder.tar_name())) |
1058 | + self.assertPathExists(os.path.join("target", builder.diff_name())) |
1059 | + self.assertPathExists(os.path.join("target", builder.changes_name())) |
1060 | |
1061 | |
1062 | class ParentDirTests(TestCase): |