From d01b4ef87efc2fd6ae0c16393f05104307a53320 Mon Sep 17 00:00:00 2001
From: Benjamin Bertrand <benjamin.bertrand@esss.se>
Date: Wed, 30 Oct 2019 22:28:38 +0100
Subject: [PATCH] Make sure to start the tests with an empty database

The tables were dropped at the end of the tests, but if CTRL-C was used,
running the tests again could fail depending of the state the database
was in.
---
 tests/functional/conftest.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/functional/conftest.py b/tests/functional/conftest.py
index ad80244..a7a5ee9 100644
--- a/tests/functional/conftest.py
+++ b/tests/functional/conftest.py
@@ -88,7 +88,9 @@ def db(app, request):
         _db.drop_all()
 
     _db.app = app
+    _db.app.elasticsearch.indices.delete("*-test", ignore=404)
     _db.engine.execute("CREATE EXTENSION IF NOT EXISTS citext")
+    _db.drop_all()
     _db.create_all()
 
     request.addfinalizer(teardown)
-- 
GitLab