From 08e8471360c3cb652a5599ad0b8a0a2c5ecb6f8f Mon Sep 17 00:00:00 2001
From: Ian Wienand <iwienand@redhat.com>
Date: Wed, 17 May 2017 18:49:12 +1000
Subject: [PATCH] Use fakelogger in test_blockdevice_mbr

Capture logging instead of putting it on stdout

Change-Id: Ic0c9f25549a1984fecf8e912e5b14845e2363730
---
 .../tests/functional/test_blockdevice_mbr.py    | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/diskimage_builder/tests/functional/test_blockdevice_mbr.py b/diskimage_builder/tests/functional/test_blockdevice_mbr.py
index 61dddad23..be6a7077d 100644
--- a/diskimage_builder/tests/functional/test_blockdevice_mbr.py
+++ b/diskimage_builder/tests/functional/test_blockdevice_mbr.py
@@ -11,9 +11,7 @@
 # under the License.
 
 import copy
-from diskimage_builder.block_device.level0.localloop import LocalLoop
-from diskimage_builder.block_device.level1.mbr import MBR
-from diskimage_builder.logging_config import setup
+import fixtures
 import logging
 import os
 import shutil
@@ -21,6 +19,12 @@ import subprocess
 import tempfile
 import testtools
 
+from diskimage_builder.block_device.level0.localloop import LocalLoop
+from diskimage_builder.block_device.level1.mbr import MBR
+
+
+logger = logging.getLogger(__name__)
+
 
 class TestMBR(testtools.TestCase):
 
@@ -48,7 +52,10 @@ class TestMBR(testtools.TestCase):
 
     def setUp(self):
         super(TestMBR, self).setUp()
-        setup()
+        fs = '%(asctime)s %(levelname)s [%(name)s] %(message)s'
+        self.log_fixture = self.useFixture(
+            fixtures.FakeLogger(level=logging.DEBUG,
+                                format=fs))
 
     def _create_image(self):
         tmp_dir = tempfile.mkdtemp(prefix="dib-bd-mbr-")
@@ -61,7 +68,7 @@ class TestMBR(testtools.TestCase):
         partx_path = self._get_path_for_partx()
         largs.insert(0, partx_path)
         largs.append(image_path)
-        logging.info("Running command [%s]", largs)
+        logger.info("Running command [%s]", largs)
         return subprocess.check_output(largs).decode("ascii")
 
     def test_one_ext_partition(self):