Use the built-in warnings
module's simplefilter method. Requires use of a context manager. Code example copied wholesale from the linked section:
import warnings
def fxn():
warnings.warn("deprecated", DeprecationWarning)
with warnings.catch_warnings():
warnings.simplefilter("ignore")
fxn()
Further arguments to simplefilter
allow you to filter just the warnings you're getting from the specific place in the code you know about-- probably a good idea so other, new warnings that arise later won't be obscured.