python3.11 support?

#51 · closed · 2 comments

View on GitHub ↗

mr-c

Hello, The next stable release of Debian includes Python 3.11 (and might make Python 3.11 the default version) [Running the unit tests from version 0.6.0 or version 21.6.0 under Python 3.11 produces the following errors](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1024861): ``` ====================================================================== ERROR: test_typo_enter (test.test_contextlib.TestContextDecorator.test_typo_enter) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/autopkgtest.oVLsYe/build.IvE/src/test/test_contextlib.py", line 498, in test_typo_enter with mycontext(): TypeError: 'mycontext' object does not support the context manager protocol ====================================================================== ERROR: test_typo_exit (test.test_contextlib.TestContextDecorator.test_typo_exit) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/autopkgtest.oVLsYe/build.IvE/src/test/test_contextlib.py", line 510, in test_typo_exit with mycontext(): TypeError: 'mycontext' object does not support the context manager protocol (missed __exit__ method) ---------------------------------------------------------------------- ``` Any guidance on how we can patch contextlib2 version 21.6.0 to fix this? Thanks!

Comments

mr-c

Ah, this is a dupe of #43 ; I'll close this, sorry!

ncoghlan

For the record, the test suite fix was to change the offending tests to allow either `TypeError` or `AttributeError` as the exception here (it switched exception types in 3.11+ due to changes in the way `with` and `async with` statements work) Fixed in #58