mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-10-22 03:16:15 -05:00
Compare commits
3 Commits
v2.19.0
...
chore/disa
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1f461a7ee4 | ||
![]() |
a2ce0af79f | ||
![]() |
ba40626838 |
@@ -241,7 +241,7 @@ addopts = [
|
|||||||
"--numprocesses=auto",
|
"--numprocesses=auto",
|
||||||
"--maxprocesses=16",
|
"--maxprocesses=16",
|
||||||
"--quiet",
|
"--quiet",
|
||||||
"--durations=50",
|
"--durations=0",
|
||||||
"--junitxml=junit.xml",
|
"--junitxml=junit.xml",
|
||||||
"-o junit_family=legacy",
|
"-o junit_family=legacy",
|
||||||
]
|
]
|
||||||
@@ -249,6 +249,10 @@ norecursedirs = [ "src/locale/", ".venv/", "src-ui/" ]
|
|||||||
|
|
||||||
DJANGO_SETTINGS_MODULE = "paperless.settings"
|
DJANGO_SETTINGS_MODULE = "paperless.settings"
|
||||||
|
|
||||||
|
markers = [
|
||||||
|
"use_whitenoise: mark test to run with Whitenoise middleware enabled",
|
||||||
|
]
|
||||||
|
|
||||||
[tool.pytest_env]
|
[tool.pytest_env]
|
||||||
PAPERLESS_DISABLE_DBHANDLER = "true"
|
PAPERLESS_DISABLE_DBHANDLER = "true"
|
||||||
PAPERLESS_CACHE_BACKEND = "django.core.cache.backends.locmem.LocMemCache"
|
PAPERLESS_CACHE_BACKEND = "django.core.cache.backends.locmem.LocMemCache"
|
||||||
|
@@ -28,3 +28,22 @@ def authenticated_rest_api_client(rest_api_client: APIClient):
|
|||||||
user = UserModel.objects.create_user(username="testuser", password="password")
|
user = UserModel.objects.create_user(username="testuser", password="password")
|
||||||
rest_api_client.force_authenticate(user=user)
|
rest_api_client.force_authenticate(user=user)
|
||||||
yield rest_api_client
|
yield rest_api_client
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def configure_whitenoise_middleware(request, settings):
|
||||||
|
"""
|
||||||
|
By default, remove Whitenoise middleware from tests.
|
||||||
|
Only include it when test is marked with @pytest.mark.use_whitenoise
|
||||||
|
"""
|
||||||
|
# Check if the test is marked to use whitenoise
|
||||||
|
use_whitenoise_marker = request.node.get_closest_marker("use_whitenoise")
|
||||||
|
|
||||||
|
if not use_whitenoise_marker:
|
||||||
|
# Filter out whitenoise middleware using pytest-django's settings fixture
|
||||||
|
middleware_without_whitenoise = [
|
||||||
|
mw for mw in settings.MIDDLEWARE if "whitenoisemiddleware" not in mw.lower()
|
||||||
|
]
|
||||||
|
|
||||||
|
settings.MIDDLEWARE = middleware_without_whitenoise
|
||||||
|
yield
|
||||||
|
Reference in New Issue
Block a user