aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuilherme Salgado <guilherme.salgado@linaro.org>2011-11-21 10:48:20 -0300
committerGuilherme Salgado <guilherme.salgado@linaro.org>2011-11-21 10:48:20 -0300
commit89eea1573b7329a021fe87a25364f5e6da3f0ecb (patch)
tree25f17c111927add89fc6d3d6dd12062f60ee5a99
parent0d51db3ad7212be10e84dd5a586d11cb7ecc1349 (diff)
Use testtools.try_import for CommandNotFound; that way our pyflakes test can expect a clean output
-rw-r--r--README4
-rw-r--r--linaro_image_tools/tests/test_pyflakes.py6
-rw-r--r--linaro_image_tools/utils.py7
3 files changed, 6 insertions, 11 deletions
diff --git a/README b/README
index 1cfa052..aabc2d0 100644
--- a/README
+++ b/README
@@ -22,8 +22,8 @@ installed:
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
diff --git a/linaro_image_tools/tests/test_pyflakes.py b/linaro_image_tools/tests/test_pyflakes.py
index 6fb0c02..0453f68 100644
--- a/linaro_image_tools/tests/test_pyflakes.py
+++ b/linaro_image_tools/tests/test_pyflakes.py
@@ -27,10 +27,6 @@ class TestPyflakes(TestCase):
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)
diff --git a/linaro_image_tools/utils.py b/linaro_image_tools/utils.py
index 9bd6e3f..4c9ea06 100644
--- a/linaro_image_tools/utils.py
+++ b/linaro_image_tools/utils.py
@@ -25,13 +25,12 @@ import logging
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')