set test_errors app fixture to session scope

we have one global metrics variable `metrics = GDSMetrics()`, and we
then call `metrics.init_app` from within the flask application set up.
The v2/test_errors.py app_for_test fixture calls create_app, would call
metrics.init_app multiple times for the same metrics instance. This
causes errors, so change the fixture to session level so it only calls
once per test run.
This commit is contained in:
Leo Hemsted
2020-04-27 15:27:08 +01:00
committed by David McDonald
parent faa8faa0c4
commit cd9b80f415
2 changed files with 5 additions and 5 deletions

View File

@@ -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