diff mbox

[Branch,~linaro-image-tools/linaro-image-tools/trunk] Rev 348: Fix the logging output in linaro-hwpack-create.

Message ID 20110525210124.10110.99031.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

James Westby May 25, 2011, 9:01 p.m. UTC
Merge authors:
  James Westby (james-w)
Related merge proposals:
  https://code.launchpad.net/~james-w/linaro-image-tools/fix-logging/+merge/62333
  proposed by: James Westby (james-w)
  review: Approve - Mattias Backman (mabac)
------------------------------------------------------------
revno: 348 [merge]
committer: James Westby <james.westby@linaro.org>
branch nick: trunk
timestamp: Wed 2011-05-25 17:00:02 -0400
message:
  Fix the logging output in linaro-hwpack-create.
modified:
  linaro-hwpack-create
  linaro_image_tools/hwpack/tests/test_script.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 'linaro-hwpack-create'
--- linaro-hwpack-create	2011-03-23 22:25:10 +0000
+++ linaro-hwpack-create	2011-05-25 15:47:02 +0000
@@ -48,7 +48,7 @@ 
     ch.setLevel(logging.INFO)
     formatter = logging.Formatter("%(message)s")
     ch.setFormatter(formatter)
-    logger = logging.getLogger("hwpack")
+    logger = logging.getLogger("linaro_image_tools")
     logger.setLevel(logging.INFO)
     logger.addHandler(ch)
     if args.debug:

=== modified file 'linaro_image_tools/hwpack/tests/test_script.py'
--- linaro_image_tools/hwpack/tests/test_script.py	2011-03-24 11:14:44 +0000
+++ linaro_image_tools/hwpack/tests/test_script.py	2011-05-25 17:43:12 +0000
@@ -19,8 +19,11 @@ 
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
 # USA.
 
+import doctest
 import subprocess
 
+from testtools.matchers import DocTestMatches
+
 from linaro_image_tools.hwpack.hardwarepack import Metadata
 from linaro_image_tools.hwpack.testing import (
     AptSourceFixture,
@@ -89,3 +92,21 @@ 
                 metadata, [available_package],
                 {"ubuntu": source.sources_entry},
                 package_spec=package_name))
+
+    def test_log_output(self):
+        package_name = 'foo'
+        architecture = 'armel'
+        available_package = DummyFetchedPackage(
+            package_name, "1.1", architecture=architecture)
+        source = self.useFixture(AptSourceFixture([available_package]))
+        config = self.useFixture(ConfigFileFixture(
+            '[hwpack]\nname=ahwpack\npackages=%s\narchitectures=armel\n'
+            '\n[ubuntu]\nsources-entry=%s\n' % (
+                package_name, source.sources_entry)))
+        stdout, stderr = self.run_script([config.filename, "1.0"])
+        self.assertThat(
+            stderr,
+            DocTestMatches(
+                "Building for %(arch)s\nFetching packages\n"
+                "Wrote hwpack_ahwpack_1.0_%(arch)s.tar.gz"
+                "\n" % dict(arch=architecture)))