mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-07-29 07:14:56 +00:00
Adds standalone profiling tooling (never merged into dev/main): a persistent, self-healing Postgres 18 container helper (run_with_postgres.sh/stop_postgres.sh), a scale-profile dataset seeder (seed.py) whose document counts and guardian permission-row ratios mirror real bug reports (#13276, #13161), and a typed profiling harness (harness.py) for timing/query-count comparisons and EXPLAIN ANALYZE capture, gated by require_postgres() so it never silently runs on SQLite. seed.py samples distinct (subject, document) pairs up front rather than drawing with replacement, since guardian's assign_perm() dedupes on the (subject, object, permission) triple -- with-replacement sampling against a small group pool collides heavily (birthday paradox) and undercounts the target permission-row ratios otherwise.
19 lines
750 B
TOML
19 lines
750 B
TOML
[tool.pytest]
|
|
ini_options.pythonpath = [ "../src", "..", "." ]
|
|
ini_options.markers = [
|
|
"""\
|
|
profiling: Profiling scripts comparing old vs new query patterns; require a throwaway PostgreSQL container, not run \
|
|
as part of the normal test suite\
|
|
""",
|
|
]
|
|
ini_options.DJANGO_SETTINGS_MODULE = "paperless.settings"
|
|
|
|
[tool.pytest_env]
|
|
# Standalone config: this directory must be independently runnable without
|
|
# the rest of the dev stack (Redis, etc) present -- only Postgres is required,
|
|
# via run_with_postgres.sh.
|
|
PAPERLESS_SECRET_KEY = "profiling-only-insecure-key"
|
|
PAPERLESS_DISABLE_DBHANDLER = "true"
|
|
PAPERLESS_CACHE_BACKEND = "django.core.cache.backends.locmem.LocMemCache"
|
|
PAPERLESS_CHANNELS_BACKEND = "channels.layers.InMemoryChannelLayer"
|