Log python warnings only once to limit size of CI jobs' output
This patch sets to log python warnings only once in the tests and also sets some of the oslo_context warnings, related to the policy enforcement to be ignored to limit size of the output of e.g. unit tests jobs. Change-Id: I28d8a193198bbc4249cf7a37d70f065efd908c41
This commit is contained in:
parent
cfe16da2aa
commit
194b08884f
@ -26,6 +26,7 @@ import os.path
|
||||
import queue
|
||||
import threading
|
||||
from unittest import mock
|
||||
import warnings
|
||||
|
||||
import eventlet.timeout
|
||||
import fixtures
|
||||
@ -226,6 +227,17 @@ class DietTestCase(base.BaseTestCase, metaclass=_CatchTimeoutMetaclass):
|
||||
def setUp(self):
|
||||
super(DietTestCase, self).setUp()
|
||||
|
||||
# NOTE(slaweq): Make deprecation warnings only happen once.
|
||||
warnings.simplefilter("once", DeprecationWarning)
|
||||
|
||||
# NOTE(slaweq): Let's not display such warnings in tests as we know
|
||||
# that we have many places where policy enforcement depends on values
|
||||
# like is_admin or project_id and there can be a lot of such warnings
|
||||
# in the logs
|
||||
warnings.filterwarnings(
|
||||
'ignore', message=(
|
||||
'Policy enforcement is depending on the value of '))
|
||||
|
||||
# Suppress some log messages during test runs, otherwise it may cause
|
||||
# issues with subunit parser when running on Python 3. It happened for
|
||||
# example for neutron-functional tests.
|
||||
|
Loading…
x
Reference in New Issue
Block a user