about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/conftest.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 9012221..a716c52 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -2,6 +2,8 @@
 import io
 import os
 import uuid
+import shutil
+from pathlib import Path
 from hashlib import sha256
 
 import redis
@@ -46,17 +48,20 @@ def cleanup_redis(redisuri: str, prefix: str):
 @pytest.fixture(scope="module")
 def client():
     "Fixture for test client"
-    app = create_app()
     test_prefix = sha256(f"test:{uuid.uuid4()}".encode("utf8")).hexdigest()
-    app.config.update({
+    tests_work_dir = Path("/tmp/{test_prefix}")
+    tests_work_dir.mkdir(exist_ok=True)
+    app = create_app({
         "TESTING": True,
         "GNQC_REDIS_PREFIX": f"{test_prefix}:GNQC",
-        "JOBS_TTL_SECONDS": 2 * 60 * 60# 2 hours
+        "JOBS_TTL_SECONDS": 2 * 60 * 60,# 2 hours
+        "ASYNCHRONOUS_JOBS_SQLITE_DB": f"{tests_work_dir}/jobs.db"
     })
     with app.app_context():
         yield app.test_client()
 
     cleanup_redis(app.config["REDIS_URL"], test_prefix)
+    shutil.rmtree(tests_work_dir, ignore_errors=True)
 
 @pytest.fixture(scope="module")
 def db_url(client):#pylint: disable=[redefined-outer-name]