From f16b227ecea827304e4a420eeffaefc10e30ed25 Mon Sep 17 00:00:00 2001 From: dandds Date: Mon, 15 Oct 2018 10:03:13 -0400 Subject: [PATCH] catch 500 errors and remove unnecessary acceptance test fixture --- atst/routes/errors.py | 5 +++++ tests/acceptance/conftest.py | 10 ---------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/atst/routes/errors.py b/atst/routes/errors.py index 40a00c26..f2fee662 100644 --- a/atst/routes/errors.py +++ b/atst/routes/errors.py @@ -17,4 +17,9 @@ def make_error_pages(app): app.logger.error(e.message) return render_template("error.html", message="Log in Failed"), 401 + @app.errorhandler(Exception) + def exception(e): + app.logger.error(e.message) + return render_template("error.html", message="An Unexpected Error Occurred"), 500 + return app diff --git a/tests/acceptance/conftest.py b/tests/acceptance/conftest.py index 249185ca..29aa2953 100644 --- a/tests/acceptance/conftest.py +++ b/tests/acceptance/conftest.py @@ -1,7 +1,6 @@ import os import pytest import logging -from logging.handlers import RotatingFileHandler from collections import Mapping from selenium import webdriver from selenium.webdriver.common.keys import Keys @@ -18,15 +17,6 @@ def session(db, request): pass -@pytest.fixture(scope="session") -def app(app): - handler = RotatingFileHandler("log/acceptance.log", maxBytes=10000, backupCount=1) - handler.setLevel(logging.INFO) - app.logger.addHandler(handler) - - return app - - class DriverCollection(Mapping): """ Allows access to drivers with dictionary syntax. Keeps track of which ones