Silence the deprecation warning about with statements
The tests use contextlib.nested for nesting multiple with statements, but that function generates a warning in python 2.7 telling us, that there is a better syntax for it. Unfortunately, we need to support older python versions, so we can't use that new syntax. The warning is annoying, as it clobbers the output of tests and makes other warnings harder to see. This patch silences that warning in tests. Change-Id: I6e49faad4c45c13ee2e0041fe9d31b7fcd3670a6
This commit is contained in:
parent
feb8f4ac4a
commit
22df523291
@ -12,6 +12,7 @@
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
import warnings
|
||||
|
||||
from django.core.handlers import wsgi
|
||||
from django.utils import unittest
|
||||
@ -23,6 +24,11 @@ from tuskar_ui.test.test_data import utils as test_data_utils
|
||||
# Makes output of failing mox tests much easier to read.
|
||||
wsgi.WSGIRequest.__repr__ = lambda self: "<class 'django.http.HttpRequest'>"
|
||||
|
||||
# Silences the warning about with statements.
|
||||
warnings.filterwarnings('ignore', 'With-statements now directly support '
|
||||
'multiple context managers', DeprecationWarning,
|
||||
r'^tuskar_ui[.].*[._]tests$')
|
||||
|
||||
|
||||
def create_stubs(stubs_to_create={}):
|
||||
return openstack_dashboard_helpers.create_stubs(stubs_to_create)
|
||||
|
Loading…
x
Reference in New Issue
Block a user