I have some Python code, using Fabric context managers, like:
with settings(warn_only=True), hide('running', 'stdout', 'stderr', 'warnings'):
do_stuff()
and every time I run this, Python gives me the DeprecationWarning:
With-statements now directly support multiple context managers
with settings(warn_only=True), hide('running', 'stdout', 'stderr', 'warnings'):
Why am I getting this warning and how do I fix it?
I'm a bit confused, because this similar question implies I'm using nested managers, and that the fix is to rewrite them into the single line version that I'm already using.
I've tried re-writing it like:
with settings(warn_only=True) as a, hide('running', 'stdout', 'stderr', 'warnings') as b:
do_stuff()
and:
with settings(warn_only=True):
with hide('running', 'stdout', 'stderr', 'warnings'):
do_stuff()
but both give me the same warning.