Reduce extraneous test output

The tests generate a large amount of extraneous logging output.
This due to the manage utility, when tested via test_manage,
setting up logging in it's own way. Monkey patching the log.setup
call to a no-op during tests prevents this.

Also fixed an incorrect usage of assert which was causing a
warning to be generated.

Change-Id: I6b8724142c0812d84e697e280acc0264620f6a2b
This commit is contained in:
Eddie Sheffield 2014-10-13 13:14:46 -04:00
parent 2365a3fb5f
commit ee0c99c1f7
2 changed files with 10 additions and 4 deletions

View File

@ -132,10 +132,9 @@ def stub_out_registry_and_store_server(stubs, base_dir, **kwargs):
def endheaders(self):
hl = [i.lower() for i in self.req.headers.keys()]
assert(not ('content-length' in hl and
'transfer-encoding' in hl),
'Content-Length and Transfer-Encoding '
'are mutually exclusive')
assert not ('content-length' in hl and
'transfer-encoding' in hl), \
'Content-Length and Transfer-Encoding are mutually exclusive'
def send(self, data):
# send() is called during chunked-transfer encoding, and

View File

@ -32,6 +32,7 @@ class TestManageBase(testtools.TestCase):
def clear_conf():
manage.CONF.reset()
manage.CONF.unregister_opt(manage.command_opt)
clear_conf()
self.addCleanup(clear_conf)
self.patcher = mock.patch('glance.db.sqlalchemy.api.get_engine')
@ -40,6 +41,12 @@ class TestManageBase(testtools.TestCase):
def _main_test_helper(self, argv, func_name=None, *exp_args, **exp_kwargs):
self.useFixture(fixtures.MonkeyPatch('sys.argv', argv))
def setup(product_name, version='unknown'):
pass
self.useFixture(fixtures.MonkeyPatch(
'glance.openstack.common.log.setup', setup))
manage.main()
func_name.assert_called_once_with(*exp_args, **exp_kwargs)