Merge lp:~salgado/linaro-image-tools/bug-892391 into lp:linaro-image-tools/11.11

Proposed by Guilherme Salgado
Status: Merged
Merged at revision: 465
Proposed branch: lp:~salgado/linaro-image-tools/bug-892391
Merge into: lp:linaro-image-tools/11.11
Diff against target: 51 lines (+6/-11)
3 files modified
README (+2/-2)
linaro_image_tools/tests/test_pyflakes.py (+1/-5)
linaro_image_tools/utils.py (+3/-4)
To merge this branch: bzr merge lp:~salgado/linaro-image-tools/bug-892391
Reviewer Review Type Date Requested Status
Loïc Minier (community) Approve
Review via email: mp+82883@code.launchpad.net

Description of the change

Use testtools.try_import for CommandNotFound; that way our pyflakes test can expect a clean output.
(try_import was added in testtools 0.9.8, but that version is available in our PPA for Maverick/Lucid and is present in the archives for newer releases)

To post a comment you must log in.
Revision history for this message
Loïc Minier (lool) wrote :

 review approve

 Cool, thanks for fixing this!

--
Loïc Minier

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README'
2--- README 2011-07-28 10:48:11 +0000
3+++ README 2011-11-21 13:53:24 +0000
4@@ -22,8 +22,8 @@
5 Before running any tests you need to install the following packages:
6
7 - testrepository
8- - python-testtools >= 0.9.6
9- (available at https://launchpad.net/~bzr/+archive/ppa)
10+ - python-testtools >= 0.9.8
11+ (available at https://launchpad.net/~linaro-maintainers/+archive/tools)
12 - python-debian >= 0.1.16ubuntu1
13 - python-argparse
14 - dpkg-dev
15
16=== modified file 'linaro_image_tools/tests/test_pyflakes.py'
17--- linaro_image_tools/tests/test_pyflakes.py 2011-10-12 09:54:29 +0000
18+++ linaro_image_tools/tests/test_pyflakes.py 2011-11-21 13:53:24 +0000
19@@ -27,10 +27,6 @@
20 stdout=subprocess.PIPE,
21 stderr=subprocess.PIPE)
22 (stdout, stderr) = proc.communicate()
23- stdout = stdout.splitlines()
24- stdout.sort()
25- expected = ["./linaro_image_tools/utils.py:31: redefinition of "
26- "unused 'CommandNotFound' from line 29" ]
27- self.assertEquals(expected, stdout)
28+ self.assertEquals('', stdout)
29 self.assertEquals('', stderr)
30
31
32=== modified file 'linaro_image_tools/utils.py'
33--- linaro_image_tools/utils.py 2011-10-13 14:49:05 +0000
34+++ linaro_image_tools/utils.py 2011-11-21 13:53:24 +0000
35@@ -25,13 +25,12 @@
36 import tempfile
37 import tarfile
38
39-try:
40- from CommandNotFound import CommandNotFound
41-except ImportError:
42- CommandNotFound = None
43+from testtools import try_import
44
45 from linaro_image_tools import cmd_runner
46
47+CommandNotFound = try_import('CommandNotFound.CommandNotFound')
48+
49
50 def path_in_tarfile_exists(path, tar_file):
51 tarinfo = tarfile.open(tar_file, 'r:gz')

Subscribers

People subscribed via source and target branches