[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

Martin Panter report at bugs.python.org
Wed Nov 23 23:13:00 EST 2016


Martin Panter added the comment:

The tests changes also produce a DeprecationWarning:

======================================================================
ERROR: testEnterAttributeError1 (test.test_with.FailureTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/proj/python/cpython/Lib/test/test_with.py", line 120, in testEnterAttributeError1
    self.assertRaisesRegexp(AttributeError, '__enter__', fooLacksEnter)
  File "/home/proj/python/cpython/Lib/unittest/case.py", line 1311, in deprecated_func
    DeprecationWarning, 2)
DeprecationWarning: Please use assertRaisesRegex instead.

The fix is simple and just affects the tests, but since most people don’t seem to worry about warnings, I guess this can wait for 3.6 to be released before committing the fix.

----------
Added file: http://bugs.python.org/file45618/regexp-deprecated.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27100>
_______________________________________


More information about the Python-bugs-list mailing list