Skip to content

Commit 03ebfa3

Browse files
author
Aaron Suarez
committed
Raise DBAPIError rather than None
1 parent b4d281c commit 03ebfa3

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

tests/conftest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from app import app
55
from app import db as _db
66
from app.utils import standardize_response
7+
from sqlalchemy.exc import DBAPIError
78

89
TEST_DATABASE_URI = 'sqlite:///:memory:'
910

@@ -190,7 +191,7 @@ def fake_category_query_error(mocker):
190191
Mocks an exception being raised during a query to test error handling
191192
"""
192193

193-
mocker.patch('app.models.Category.query', new=None)
194+
mocker.patch('app.models.Category.query', side_effect=DBAPIError)
194195

195196

196197
@pytest.fixture(scope='function')
@@ -199,7 +200,7 @@ def fake_language_query_error(mocker):
199200
Mocks an exception being raised during a query to test error handling
200201
"""
201202

202-
mocker.patch('app.models.Language.query', new=None)
203+
mocker.patch('app.models.Language.query', side_effect=DBAPIError)
203204

204205

205206
@pytest.fixture(scope='function')

0 commit comments

Comments
 (0)