peewee: test_sqlite_isolation fails with Python 3.11

When running tests with Python 3.11.0b3, I get the following failure:

$ python runtests.py 
Unable to import APSW extension tests, skipping.
Unable to import CockroachDB tests, skipping.
Unable to import sqlite C extension tests, skipping.
Unable to import mysql-connector, skipping mysql_ext tests.
Unable to import postgres extension tests, skipping.
Unable to import SQLCipher extension tests, skipping.
Unable to import sqlite extension tests, skipping.
.s.....................s..................................s.....................sss...........................................s.......ss.....................................s........ssss............................................s...................................s.........................................................................s..................................................................................................................................................................ssss........................................ss.............................s..................s...........ss............s...s.........s....ss......s..............s..............................................................ss.......................E............ssssssss.....................................sss.......ssssssssssssss.....s..................s..ss..............................
======================================================================
ERROR: test_sqlite_isolation (tests.db_tests.TestSqliteIsolation.test_sqlite_isolation)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/peewee/tests/db_tests.py", line 461, in test_sqlite_isolation
    self.assertEqual(curs.fetchone()[0], 0)
                     ~~~~~~~~~~~~~~~^^^
TypeError: 'NoneType' object is not subscriptable

----------------------------------------------------------------------
Ran 894 tests in 5.487s

FAILED (errors=1, skipped=65)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

FYI, the fix has been merged and will appear in the upcoming beta 4 release.

Thank you both @mgorny and @erlend-aasland for the help finding and fixing this.

(I’ve applied it on top of 3.11.0b3)

I can confirm that applying this patch to cpython causes peewee tests to pass.

No worries, I’ll take a look tomorrow (Mon) morning and let you know asap. Thx!

Sure I’ll report and send a test if it’s indeed a cpython issue. My sense is that it is but I’ll let you know early next week

Thanks @mgorny very nice! My sense is that this may be a bug in sqlite3 (cc @erlend-aasland if you see this).