Make the PostgreSQL output test independent of psycopg

testPostgreSQLExceptionsAreRecorded replaces PostgreSQLClient with a
mock, but _init_output_clients() first checks postgres.psycopg and
raises ConfigurationError when the extra is missing, so the client was
never built and the saver mocks were never called. Patch psycopg with a
stand-in so the test passes whether or not the postgresql extra is
installed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Sean WhalenandClaude Sonnet 5.5 committed 2026-11-09 15:40:09 -05:00
1 parent 2ee209005b
commit 8c00e1a695
1 file changed
+3
+3
View File
@@ -10734,6 +10734,9 @@ class TestOutputDestinationExceptionsMarkTheBatchUnsaved(unittest.TestCase):
"[postgresql]\nhost = db.example.com\n",
{batch_key: [report]},
patch("parsedmarc.cli.postgres.PostgreSQLClient", client_cls),
# The startup guard checks the SDK, not the client class;
# without a stand-in the test needs the postgresql extra.
patch("parsedmarc.cli.postgres.psycopg", object()),
)
client = client_cls.return_value
getattr(client, saver).assert_called_once_with(report)