drop conftest use pytest_env thing

This commit is contained in:
shamoon
2026-03-03 12:08:55 -08:00
parent 027e7717fc
commit bcab21a365
3 changed files with 14 additions and 18 deletions
+1
View File
@@ -309,6 +309,7 @@ markers = [
[tool.pytest_env]
PAPERLESS_DISABLE_DBHANDLER = "true"
PAPERLESS_CACHE_BACKEND = "django.core.cache.backends.locmem.LocMemCache"
PAPERLESS_CHANNELS_BACKEND = "channels.layers.InMemoryChannelLayer"
[tool.coverage.report]
exclude_also = [
-11
View File
@@ -1,11 +0,0 @@
import pytest
from pytest_django.fixtures import SettingsWrapper
@pytest.fixture(autouse=True)
def in_memory_channel_layers(settings: SettingsWrapper) -> None:
settings.CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels.layers.InMemoryChannelLayer",
},
}
+13 -7
View File
@@ -491,18 +491,24 @@ TEMPLATES = [
},
]
_CHANNELS_BACKEND = os.environ.get(
"PAPERLESS_CHANNELS_BACKEND",
"channels_redis.pubsub.RedisPubSubChannelLayer",
)
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.pubsub.RedisPubSubChannelLayer",
"CONFIG": {
"hosts": [_CHANNELS_REDIS_URL],
"capacity": 2000, # default 100
"expiry": 15, # default 60
"prefix": _REDIS_KEY_PREFIX,
},
"BACKEND": _CHANNELS_BACKEND,
},
}
if _CHANNELS_BACKEND.startswith("channels_redis."):
CHANNEL_LAYERS["default"]["CONFIG"] = {
"hosts": [_CHANNELS_REDIS_URL],
"capacity": 2000, # default 100
"expiry": 15, # default 60
"prefix": _REDIS_KEY_PREFIX,
}
###############################################################################
# Email (SMTP) Backend #
###############################################################################