Lines Matching full:warnings
5 import warnings
12 with warnings.catch_warnings(record=True) as warns:
13 warnings.simplefilter('always', SyntaxWarning)
30 with warnings.catch_warnings(record=True) as warns:
31 warnings.simplefilter('error', SyntaxWarning)
34 # No warnings are leaked when a SyntaxError is raised.
39 """Decorator to suppress deprecation warnings.
41 Use of context managers to hide warnings make diffs
47 with warnings.catch_warnings():
48 warnings.simplefilter('ignore', category=category)
55 """Convenience wrapper for the warnings list returned on
56 entry to the warnings.catch_warnings() context manager.
65 elif attr in warnings.WarningMessage._WARNING_DETAILS:
70 def warnings(self): member in WarningsRecorder
79 """Context manager to silence warnings.
103 """Context manager to check that no warnings are emitted.
106 and checks that no warnings are emitted even with that warning
110 for warnings. This may help to catch warnings emitted when objects
113 Other keyword arguments are passed to warnings.filterwarnings().
116 with warnings.catch_warnings(record=True) as warns:
117 warnings.filterwarnings('always',
145 """Catch the warnings, then check if all the expected
146 warnings have been raised and re-raise unexpected warnings.
147 If 'quiet' is True, only re-raise the unexpected warnings.
150 # in order to re-raise the warnings.
155 with warnings.catch_warnings(record=True) as w:
156 # Set filter "always" to record all warnings. Because
159 sys.modules['warnings'].simplefilter("always")
161 # Filter the recorded warnings
185 old_filters = warnings.filters[:]
189 warnings.filters[:] = old_filters
193 warnings.warn(