Skip to content

tests/test_storage: Fix tests execution with psycopg2 < 2.8

This is another attempt to fix a psycopg2 related issue (see !245 (closed)).

psycopg2 introduced new exception types in its 2.8 version giving more details about the encountered errors. These exceptions live in the newly added module psycopg2.errors.

Unfortunately, current Debian package python3-psycopg2 version is 2.7.7 on buster and 2.6.2 on stretch. So this means Debian packaging and tests execution when not using a virtualenv on Debian stable are currently broken for swh-storage.

Fortunately, the newly added exceptions in version 2.8 are derived from previously available ones for backward compatibility.

So use psycopg2 exceptions common to all module versions to ensure tests can be executed everywhere.


Migrated from D1955 (view on Phabricator)

Merge request reports