diff --git a/app/__init__.py b/app/__init__.py index 236a81a6c..aefc92d08 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -368,9 +368,9 @@ def setup_sqlalchemy_events(app): # this will overwrite any previous checkout_at timestamp connection_record.info['checkout_at'] = time.monotonic() - # checkin runs after the request is already torn down so we'll need to capture request info earlier. - # checkout runs when the connection is first used, ie: when we first make a query, so within the request or - # task + # checkin runs after the request is already torn down, therefore we add the request_data onto the + # connection_record as otherwise it won't have that information when checkin actually runs. + # Note: this is not a problem for checkouts as the checkout always happens within a web request or task # web requests if has_request_context(): diff --git a/tests/app/v2/test_errors.py b/tests/app/v2/test_errors.py index 1b3416bce..7c1c6b09a 100644 --- a/tests/app/v2/test_errors.py +++ b/tests/app/v2/test_errors.py @@ -3,8 +3,8 @@ from flask import url_for from sqlalchemy.exc import DataError -@pytest.fixture(scope='function') -def app_for_test(mocker): +@pytest.fixture(scope='session') +def app_for_test(): import flask from flask import Blueprint from app.authentication.auth import AuthError