Lines Matching refs:warnings
6 import warnings
11 with warnings.catch_warnings():
12 warnings.simplefilter('ignore', category=DeprecationWarning)
20 with warnings.catch_warnings(record=True) as warns:
21 warnings.simplefilter('always', SyntaxWarning)
38 with warnings.catch_warnings(record=True) as warns:
39 warnings.simplefilter('error', SyntaxWarning)
42 # No warnings are leaked when a SyntaxError is raised.
47 """Decorator to suppress warnings.
49 Use of context managers to hide warnings make diffs
55 with warnings.catch_warnings():
56 warnings.simplefilter('ignore', category=category)
63 """Convenience wrapper for the warnings list returned on
64 entry to the warnings.catch_warnings() context manager.
73 elif attr in warnings.WarningMessage._WARNING_DETAILS:
78 def warnings(self):
87 """Context manager to silence warnings.
111 """Context manager to check that no warnings are emitted.
114 and checks that no warnings are emitted even with that warning
118 for warnings. This may help to catch warnings emitted when objects
121 Other keyword arguments are passed to warnings.filterwarnings().
124 with warnings.catch_warnings(record=True) as warns:
125 warnings.filterwarnings('always',
153 """Catch the warnings, then check if all the expected
154 warnings have been raised and re-raise unexpected warnings.
155 If 'quiet' is True, only re-raise the unexpected warnings.
158 # in order to re-raise the warnings.
163 with warnings.catch_warnings(record=True) as w:
164 # Set filter "always" to record all warnings. Because
167 sys.modules['warnings'].simplefilter("always")
169 # Filter the recorded warnings
193 old_filters = warnings.filters[:]
197 warnings.filters[:] = old_filters
201 warnings.warn(