Brett Cannon added the comment:

You need to temporarily turn on warnings for it to work. For example:

  with warnings.catch_warnings():
      warnings.simplefilter('always')
      with self.assertWarnsRegex(DeprecationWarning, "reserved keyword"):
        exec('async = 33')

Do notice I used exec() as otherwise the warning will be triggered at import 
instead of when the test runs.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26182>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to