Skip to content

Commit f4393ba

Browse files
authored
Merge pull request #160 from asherf/lint
Avoid hard coding temporary directories.
2 parents c503747 + 683cc1d commit f4393ba

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

django_prometheus/tests/end2end/testapp/settings.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
1414
import os
15-
15+
import tempfile
1616
import django
1717

1818
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -128,6 +128,7 @@ def GetMiddlewareClasses():
128128
}
129129

130130
# Caches
131+
_tmp_cache_dir = tempfile.mkdtemp()
131132

132133
CACHES = {
133134
"default": {
@@ -140,11 +141,11 @@ def GetMiddlewareClasses():
140141
},
141142
"filebased": {
142143
"BACKEND": "django_prometheus.cache.backends.filebased.FileBasedCache",
143-
"LOCATION": "/var/tmp/django_cache",
144+
"LOCATION": os.path.join(_tmp_cache_dir, "django_cache"),
144145
},
145146
"locmem": {
146147
"BACKEND": "django_prometheus.cache.backends.locmem.LocMemCache",
147-
"LOCATION": "/var/tmp/locmem_cache",
148+
"LOCATION": os.path.join(_tmp_cache_dir, "locmem_cache"),
148149
},
149150
"redis": {
150151
"BACKEND": "django_prometheus.cache.backends.redis.RedisCache",

0 commit comments

Comments
 (0)