summaryrefslogtreecommitdiff
path: root/tests/integration/test_sqlite.py
diff options
context:
space:
mode:
authorJordan Cook <jordan.cook@pioneer.com>2021-04-22 20:28:51 -0500
committerJordan Cook <jordan.cook@pioneer.com>2021-04-22 20:55:23 -0500
commit26f41c191c69a3d97e06cfa950b8c55867b7d9eb (patch)
tree4d323683d00a3d83364ce9d9b1cf460cd3b0b247 /tests/integration/test_sqlite.py
parentca49461153ee321b757fb171bb9c8f22e7840e75 (diff)
downloadrequests-cache-26f41c191c69a3d97e06cfa950b8c55867b7d9eb.tar.gz
Add use_temp option to SQLite backend
Closes #243
Diffstat (limited to 'tests/integration/test_sqlite.py')
-rw-r--r--tests/integration/test_sqlite.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/integration/test_sqlite.py b/tests/integration/test_sqlite.py
index fd463ac..6efba0b 100644
--- a/tests/integration/test_sqlite.py
+++ b/tests/integration/test_sqlite.py
@@ -1,4 +1,5 @@
import os
+from tempfile import gettempdir
from threading import Thread
from unittest.mock import patch
@@ -8,6 +9,8 @@ from tests.integration.base_storage_test import CACHE_NAME, BaseStorageTest
class SQLiteTestCase(BaseStorageTest):
+ init_kwargs = {'use_temp': True}
+
@classmethod
def teardown_class(cls):
try:
@@ -15,6 +18,12 @@ class SQLiteTestCase(BaseStorageTest):
except Exception:
pass
+ def test_use_temp(self):
+ relative_path = self.storage_class(CACHE_NAME).db_path
+ temp_path = self.storage_class(CACHE_NAME, use_temp=True).db_path
+ assert not relative_path.startswith(gettempdir())
+ assert temp_path.startswith(gettempdir())
+
def test_bulk_commit(self):
cache = self.init_cache()
with cache.bulk_commit():