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={})[source]

Turn on the feature that turns deprecations into exceptions.

Parameters:
include_astropy_deprecations : bool

If set to True, AstropyDeprecationWarning and AstropyPendingDeprecationWarning are also turned into exceptions.

modules_to_ignore_on_import : list of str

List of additional modules that generate deprecation warnings on import, which are to be ignored. By default, these are already included: compiler, scipy, pygments, ipykernel, and setuptools.

warnings_to_ignore_entire_module : list of str

List of modules with deprecation warnings to ignore completely, not just during import. If include_astropy_deprecations=True is given, AstropyDeprecationWarning and AstropyPendingDeprecationWarning are also ignored for the modules.

warnings_to_ignore_by_pyver : dict

Dictionary mapping tuple of (major, minor) Python version to a list of (warning_message, warning_class) to ignore. Python version-agnostic warnings should be mapped to None key. This is in addition of those already ignored by default (see _warnings_to_ignore_by_pyver values).