Chore: Drop system check for deprecated convert variables

A dedicated system check for the two deprecated ImageMagick convert variables is more machinery than a simple deprecation needs.

Remove the check and its tests. The settings removal, the deprecation notes in the configuration docs, and the example configuration cleanup stay as they were.
This commit is contained in:
stumpylog committed 2026-10-07 13:47:50 -07:00
1 parent 8f73514fbb
commit 901dd4be93
2 files changed
+1 -124

No files matched your search

-31
View File
@@ -337,37 +337,6 @@ def check_deprecated_v2_ocr_env_vars(
return warnings
DEPRECATED_CONVERT_ENV_VARS: dict[str, str] = {
"PAPERLESS_CONVERT_MEMORY_LIMIT": "paperless.W004",
"PAPERLESS_CONVERT_TMPDIR": "paperless.W005",
}
@register()
def check_deprecated_convert_env_vars(
app_configs: object,
**kwargs: object,
) -> list[Warning]:
"""Warn when the deprecated ImageMagick convert environment variables are set.
PDF thumbnails no longer use ImageMagick, so these variables are ignored.
"""
warnings: list[Warning] = []
for var, check_id in DEPRECATED_CONVERT_ENV_VARS.items():
if os.environ.get(var):
warnings.append(
Warning(
f"{var} is deprecated, has no effect and will be removed "
"in a future release.",
hint="It can be removed from your environment or configuration.",
id=check_id,
),
)
return warnings
def get_tesseract_langs():
proc = subprocess.run(
[shutil.which("tesseract"), "--list-langs"],
+1 -93
View File
@@ -1,4 +1,4 @@
"""Tests for v3 system checks: deprecated environment variable warnings."""
"""Tests for v3 system checks: deprecated v2 OCR env var warnings."""
from __future__ import annotations
@@ -7,7 +7,6 @@ from typing import TYPE_CHECKING
import pytest
from paperless.checks import check_deprecated_convert_env_vars
from paperless.checks import check_deprecated_v2_ocr_env_vars
if TYPE_CHECKING:
@@ -63,94 +62,3 @@ class TestDeprecatedV2OcrEnvVarWarnings:
warning = result[0]
assert warning.id == expected_id
assert expected_fragment in warning.msg
class TestDeprecatedConvertEnvVarWarnings:
def test_no_deprecated_vars_returns_empty(self, mocker: MockerFixture) -> None:
"""
GIVEN:
- Neither deprecated convert variable is set
WHEN:
- The deprecated convert check runs
THEN:
- No warnings are returned
"""
mocker.patch.dict(os.environ, {}, clear=True)
assert check_deprecated_convert_env_vars(None) == []
def test_empty_value_returns_empty(self, mocker: MockerFixture) -> None:
"""
GIVEN:
- A deprecated convert variable is set to an empty string
WHEN:
- The deprecated convert check runs
THEN:
- No warnings are returned
"""
mocker.patch.dict(
os.environ,
{"PAPERLESS_CONVERT_TMPDIR": ""},
clear=True,
)
assert check_deprecated_convert_env_vars(None) == []
@pytest.mark.parametrize(
("env_var", "env_value", "expected_id"),
[
pytest.param(
"PAPERLESS_CONVERT_MEMORY_LIMIT",
"32",
"paperless.W004",
id="memory-limit-warns",
),
pytest.param(
"PAPERLESS_CONVERT_TMPDIR",
"/var/tmp/paperless",
"paperless.W005",
id="tmpdir-warns",
),
],
)
def test_deprecated_var_produces_one_warning(
self,
mocker: MockerFixture,
env_var: str,
env_value: str,
expected_id: str,
) -> None:
"""
GIVEN:
- One deprecated convert variable is set
WHEN:
- The deprecated convert check runs
THEN:
- Exactly one warning naming that variable is returned
"""
mocker.patch.dict(os.environ, {env_var: env_value}, clear=True)
result = check_deprecated_convert_env_vars(None)
assert len(result) == 1
assert result[0].id == expected_id
assert env_var in result[0].msg
assert "no effect" in result[0].msg
def test_both_vars_produce_two_warnings(self, mocker: MockerFixture) -> None:
"""
GIVEN:
- Both deprecated convert variables are set
WHEN:
- The deprecated convert check runs
THEN:
- One warning per variable is returned
"""
mocker.patch.dict(
os.environ,
{
"PAPERLESS_CONVERT_MEMORY_LIMIT": "32",
"PAPERLESS_CONVERT_TMPDIR": "/var/tmp/paperless",
},
clear=True,
)
result = check_deprecated_convert_env_vars(None)
assert {w.id for w in result} == {"paperless.W004", "paperless.W005"}