Skip to content

Commit d725a0f

Browse files
committed
Fix test db config
1 parent 5dd5b06 commit d725a0f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/databass/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@
1414
def create_app():
1515
app = Flask(__name__, instance_relative_config=False)
1616
app.config.from_object("config.Config")
17-
app.static_folder = "static"
18-
app_db.init_app(app)
1917

2018
is_testing = (
2119
"PYTEST_CURRENT_TEST" in os.environ
2220
or app.config.get("TESTING", False)
2321
or os.environ.get("TESTING", "").lower() == "true"
2422
)
23+
if is_testing:
24+
app.config.SQLALCHEMY_DATABASE_URI = "sqlite:///:memory:"
25+
26+
app.static_folder = "static"
27+
app_db.init_app(app)
2528

2629
if not is_testing:
2730
assets = Environment(app)
@@ -38,8 +41,6 @@ def create_app():
3841
)
3942
assets.register("main_js", js_bundle)
4043
js_bundle.build()
41-
else:
42-
app.config.SQLALCHEMY_DATABASE_URI = "sqlite:///:memory:"
4344

4445
with app.app_context():
4546
from .db.models import Base, Release, Artist, Label, Genre, Review, Goal

0 commit comments

Comments
 (0)