In Lib/sqlite3/tests/dbapi.py there are no unit tests which test out sqlite3's 'insert or [algorithm].' These algorithms are also referred to as SQL 'insert on conflict.' More details at, https://www.sqlite.org/lang_conflict.html Not having unit tests for these features, especially 'insert or rollback,' seems like an easy way for timing and threading bugs to get lost in the database api.
I've added a set of tests which test the insert or [algorithm] branch of sqlite. It took some getting used to python.sqlite3's transaction model but I think I have a much better understanding now.
Thanks for the patch Alex. Some quick review comments: * We need to skip SqliteOnConflictTests if the installed sqlite3 doesn't support the feature * There is no need to duplicate https://www.sqlite.org/lang_conflict.html in every test. You can add it to SqliteOnConflictTests docstring. * Instead of ``try: except sqlite.IntegrityError: `` we can make sure that sqlite.IntegrityError is raised by using assertRaises (like you did in CheckOnConflictFail.) * The following pattern can be replaced with a list comprehension: + returned_rows = [] + for row in self.cu: + returned_rows.append(row)