Issue 21250: sqlite3 doesn't have unit tests for 'insert or [algorithm]' functionality. (original) (raw)

Issue21250

Created on 2014-04-16 07:52 by Alex.LordThorsen, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
sqlite_tests.patch Alex.LordThorsen,2015-04-15 21:08
Messages (7)
msg216448 - (view) Author: Alex LordThorsen (Alex.LordThorsen) * Date: 2014-04-16 07:52
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.
msg216538 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-04-16 18:16
Are you interested in submitting a patch?
msg216580 - (view) Author: Alex LordThorsen (Alex.LordThorsen) * Date: 2014-04-16 20:23
Yes, I'm going to work on one after I fix Issue16864 today.
msg241160 - (view) Author: Alex LordThorsen (Alex.LordThorsen) * Date: 2015-04-15 21:08
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.
msg268364 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-06-12 11:21
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)
msg274658 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-09-06 23:05
New changeset 91d3022b3f03 by Berker Peksag in branch '3.5': Issue #21250: Add tests for SQLite's ON CONFLICT clause https://hg.python.org/cpython/rev/91d3022b3f03 New changeset db2bedd5c34a by Berker Peksag in branch 'default': Issue #21250: Merge from 3.5 https://hg.python.org/cpython/rev/db2bedd5c34a
msg274659 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-09-06 23:07
Thanks for the patch, Alex!
History
Date User Action Args
2022-04-11 14:58:01 admin set github: 65449
2016-09-06 23:07:57 berker.peksag set status: open -> closedresolution: fixedmessages: + stage: patch review -> resolved
2016-09-06 23:05:14 python-dev set nosy: + python-devmessages: +
2016-06-12 11:21:08 berker.peksag set versions: + Python 3.6, - Python 2.7, Python 3.4nosy: + berker.peksagmessages: + stage: needs patch -> patch review
2015-08-19 09:56:18 ghaering set assignee: ghaering
2015-04-16 15:57:00 raulcd set nosy: + raulcd
2015-04-15 21:09:03 Alex.LordThorsen set components: + Library (Lib)
2015-04-15 21:08:22 Alex.LordThorsen set files: + sqlite_tests.patchkeywords: + patchmessages: +
2014-04-16 20:23:31 Alex.LordThorsen set messages: +
2014-04-16 18:16:38 ned.deily set versions: - Python 3.1, Python 3.2, Python 3.3nosy: + ghaering, ned.deilymessages: + stage: needs patch
2014-04-16 07:52:41 Alex.LordThorsen create