diff --git a/ash.py b/ash.py index 7571af9..968b36a 100644 --- a/ash.py +++ b/ash.py @@ -4,6 +4,7 @@ from __future__ import annotations +import os import re import pprint import itertools @@ -27,10 +28,11 @@ class DefaultConfig: app = flask.Flask(__name__, static_url_path='/tweet/static') app.config.from_object(DefaultConfig) -try: - app.config.from_object('config.Config') -except ImportError: - pass +if not os.environ.get('TESTING'): + try: + app.config.from_object('config.Config') + except ImportError: + pass # Set up external Tweets support diff --git a/tests/conftest.py b/tests/conftest.py index 2d32741..4041080 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,11 +7,11 @@ import pytest from elasticsearch import Elasticsearch -from ash import app - @pytest.fixture def client(es_host, es_index): + os.environ['TESTING'] = 'True' + from ash import app app.config.update({ 'TESTING': True, 'T_ES_HOST': es_host,