Chore: make the backend test suite pass on PostgreSQL

Remove SQLite-only assumptions from the tests: hard-coded primary keys,
NULL ordering, the database vendor, and the CPU-dependent default process
count. Keep the test connection open inside the test transaction, since
close_old_connections() and connections.close_all() really close it on
PostgreSQL.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
stumpylogandClaude Sonnet 5.5 committed 2026-10-30 12:16:35 -07:00
1 parent 80a1827fa0
commit 2cb04b0b8b
13 files changed
+121 -79

No files matched your search

+2 -4
View File
@@ -1031,9 +1031,7 @@ class TestPDFActions(DirectoriesMixin, TestCase):
with self.assertLogs("paperless.bulk_edit", level="ERROR") as cm:
bulk_edit.merge(doc_ids)
error_str = cm.output[0]
expected_str = (
"Error merging document 2, it will not be included in the merge"
)
expected_str = f"Error merging document {self.doc2.id}, it will not be included in the merge"
self.assertIn(expected_str, error_str)
mock_consume_file.assert_not_called()
@@ -1193,7 +1191,7 @@ class TestPDFActions(DirectoriesMixin, TestCase):
with self.assertLogs("paperless.bulk_edit", level="ERROR") as cm:
bulk_edit.split(doc_ids, pages)
error_str = cm.output[0]
expected_str = "Error splitting document 2"
expected_str = f"Error splitting document {self.doc2.id}"
self.assertIn(expected_str, error_str)
mock_consume_file.assert_not_called()