Skip to content

Commit

Permalink
tests: apply changes for sqlalchemy>=2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
utnapischtim committed Dec 4, 2024
1 parent 4e4efa2 commit 0ffc759
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@ def base_app(app_config):
base_app.register_blueprint(create_accounts_blueprint(base_app))

with base_app.app_context():
if str(db.engine.url) != "sqlite://" and not database_exists(
str(db.engine.url)
if str(
db.engine.url.render_as_string(hide_password=False)
) != "sqlite://" and not database_exists(
str(db.engine.url.render_as_string(hide_password=False))
):
create_database(str(db.engine.url))
create_database(str(db.engine.url.render_as_string(hide_password=False)))
db.create_all()

# Taken from: https://github.com/inveniosoftware/invenio-accounts/blob/3ecc1a70da3636618fe14ff2ebf754eed9ec75a1/tests/conftest.py#L94-L112
Expand All @@ -128,7 +130,7 @@ def delete_user_from_cache(exception):
yield base_app

with base_app.app_context():
drop_database(str(db.engine.url))
drop_database(str(db.engine.url.render_as_string(hide_password=False)))
shutil.rmtree(instance_path)


Expand Down

0 comments on commit 0ffc759

Please sign in to comment.