enable_deprecations_as_exceptions¶
- astropy.tests.helper.enable_deprecations_as_exceptions(include_astropy_deprecations=True, modules_to_ignore_on_import=[], warnings_to_ignore_entire_module=[], warnings_to_ignore_by_pyver={})[源代码]¶
启用将不推荐转换为异常的功能。
- 参数
- include_astropy_deprecations布尔
如果设置为
True
,AstropyDeprecationWarning
和AstropyPendingDeprecationWarning
也变成了例外。- modules_to_ignore_on_importstr列表
在导入时生成不推荐使用警告的其他模块的列表,这些模块将被忽略。默认情况下,这些已包括:
compiler
,scipy
,pygments
,ipykernel
和setuptools
.- warnings_to_ignore_entire_modulestr列表
要完全忽略不推荐警告的模块列表,而不仅仅是在导入期间。如果
include_astropy_deprecations=True
给出,AstropyDeprecationWarning
和AstropyPendingDeprecationWarning
对于模块也将忽略。- warnings_to_ignore_by_pyver双关语
字典映射元组
(major, minor)
Python版本(warning_message, warning_class)
忽略。Python版本不可知的警告应映射到None
key. This is in addition of those already ignored by default (see ``_ 警告“忽略”按“值”忽略。