mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-28 12:54:15 +02:00
Fix compound foreign key test failure against sqlean
test_create_table_compound_foreign_key_enforced caught the stdlib sqlite3.IntegrityError, but sqlean's IntegrityError is not a subclass of it. Import sqlite3 from sqlite_utils.utils like the other test modules, so the right exception is used whichever backend is installed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
5b61530965
commit
658185d297
1 changed files with 1 additions and 2 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
import pytest
|
import pytest
|
||||||
from sqlite_utils import Database
|
from sqlite_utils import Database
|
||||||
from sqlite_utils.db import AlterError, ForeignKey
|
from sqlite_utils.db import AlterError, ForeignKey
|
||||||
|
from sqlite_utils.utils import sqlite3
|
||||||
|
|
||||||
COMPOUND_SCHEMA = """
|
COMPOUND_SCHEMA = """
|
||||||
CREATE TABLE departments (
|
CREATE TABLE departments (
|
||||||
|
|
@ -185,8 +186,6 @@ def test_create_table_compound_foreign_key_enforced(departments_db):
|
||||||
departments_db["courses"].insert(
|
departments_db["courses"].insert(
|
||||||
{"course_code": "CS101", "campus_name": "Berkeley", "dept_code": "CS"}
|
{"course_code": "CS101", "campus_name": "Berkeley", "dept_code": "CS"}
|
||||||
)
|
)
|
||||||
import sqlite3
|
|
||||||
|
|
||||||
with pytest.raises(sqlite3.IntegrityError):
|
with pytest.raises(sqlite3.IntegrityError):
|
||||||
departments_db.execute(
|
departments_db.execute(
|
||||||
"insert into courses (course_code, campus_name, dept_code) "
|
"insert into courses (course_code, campus_name, dept_code) "
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue