Skip to content

Commit

Permalink
test: do no load local config when testing
Browse files Browse the repository at this point in the history
  • Loading branch information
wzyboy committed Jul 9, 2023
1 parent 58e71f3 commit eea1ae5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions ash.py
Expand Up @@ -4,6 +4,7 @@

from __future__ import annotations

import os
import re
import pprint
import itertools
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Expand Up @@ -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,
Expand Down

0 comments on commit eea1ae5

Please sign in to comment.