Run tests in in-memory SQLite db

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
This commit is contained in:
Chenxiong Qi
2019-11-14 14:55:27 +08:00
parent 5979f7cd97
commit 2101f38e63
2 changed files with 2 additions and 2 deletions

View File

@@ -98,8 +98,7 @@ class TestConfiguration(BaseConfiguration):
BUILD_LOGS_NAME_FORMAT = "build-{id}.log"
LOG_BACKEND = "console"
LOG_LEVEL = "debug"
SQLALCHEMY_DATABASE_URI = environ.get(
"DATABASE_URI", "sqlite:///{0}".format(path.join(dbdir, "mbstest.db")))
SQLALCHEMY_DATABASE_URI = environ.get("DATABASE_URI", "sqlite:///:memory:")
DEBUG = True
MESSAGING = "in_memory"
PDC_URL = "https://pdc.fedoraproject.org/rest_api/v1"

View File

@@ -109,6 +109,7 @@ def clean_database(add_platform_module=True, add_default_arches=True):
# clean_database is usually called before a test run. So, it makes no sense
# to keep any changes in the transaction made by previous test.
db_session.remove()
db_session.configure(bind=db.session.get_bind())
db.drop_all()
db.create_all()