diff mbox

[Branch,~linaro-image-tools/linaro-image-tools/trunk] Rev 465: Use testtools.try_import for CommandNotFound; that way our pyflakes test can expect a clean output

Message ID 20111121141718.20939.17550.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Guilherme Salgado Nov. 21, 2011, 2:17 p.m. UTC
Merge authors:
  Guilherme Salgado (salgado)
Related merge proposals:
  https://code.launchpad.net/~salgado/linaro-image-tools/bug-892391/+merge/82883
  proposed by: Guilherme Salgado (salgado)
  review: Approve - Loïc Minier (lool)
------------------------------------------------------------
revno: 465 [merge]
committer: Guilherme Salgado <guilherme.salgado@linaro.org>
branch nick: trunk
timestamp: Mon 2011-11-21 11:15:32 -0300
message:
  Use testtools.try_import for CommandNotFound; that way our pyflakes test can expect a clean output
modified:
  README
  linaro_image_tools/tests/test_pyflakes.py
  linaro_image_tools/utils.py


--
lp:linaro-image-tools
https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk

You are subscribed to branch lp:linaro-image-tools.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'README'
--- README	2011-07-28 10:48:11 +0000
+++ README	2011-11-21 13:48:20 +0000
@@ -22,8 +22,8 @@ 
 Before running any tests you need to install the following packages:
 
   - testrepository
-  - python-testtools >= 0.9.6
-     (available at https://launchpad.net/~bzr/+archive/ppa)
+  - python-testtools >= 0.9.8
+     (available at https://launchpad.net/~linaro-maintainers/+archive/tools)
   - python-debian >= 0.1.16ubuntu1
   - python-argparse
   - dpkg-dev

=== modified file 'linaro_image_tools/tests/test_pyflakes.py'
--- linaro_image_tools/tests/test_pyflakes.py	2011-10-12 09:54:29 +0000
+++ linaro_image_tools/tests/test_pyflakes.py	2011-11-21 13:48:20 +0000
@@ -27,10 +27,6 @@ 
             stdout=subprocess.PIPE,
             stderr=subprocess.PIPE)
         (stdout, stderr) = proc.communicate()
-        stdout = stdout.splitlines()
-        stdout.sort()
-        expected = ["./linaro_image_tools/utils.py:31: redefinition of "
-                        "unused 'CommandNotFound' from line 29" ]
-        self.assertEquals(expected, stdout)
+        self.assertEquals('', stdout)
         self.assertEquals('', stderr)
 

=== modified file 'linaro_image_tools/utils.py'
--- linaro_image_tools/utils.py	2011-10-13 14:49:05 +0000
+++ linaro_image_tools/utils.py	2011-11-21 13:48:20 +0000
@@ -25,13 +25,12 @@ 
 import tempfile
 import tarfile
 
-try:
-    from CommandNotFound import CommandNotFound
-except ImportError:
-    CommandNotFound = None
+from testtools import try_import
 
 from linaro_image_tools import cmd_runner
 
+CommandNotFound = try_import('CommandNotFound.CommandNotFound')
+
 
 def path_in_tarfile_exists(path, tar_file):
     tarinfo = tarfile.open(tar_file, 'r:gz')