Skip to content

Legacy bsddb import tests fail (instead of skip) when the bsddb backend is unavailable #15

Description

@eduralph

Summary

gramps/plugins/test/imports_test.py legacy-database load tests hard-fail when the bsddb (Berkeley DB) backend cannot be loaded, instead of skipping. On any Linux environment without the berkeleydb/bsddb3 Python library installed, the whole-suite unit run reports new failures that are environmental, not code regressions.

Surfaced while running the gramps unit suite on maintenance/gramps61 (testbed harness) — previously masked by an unrelated headless-discovery segfault; once that is fixed the suite runs to completion and these reds appear.

Failing tests (7 observed)

gramps.plugins.test.imports_test.TestImports, all with the same cause:

False is not true : Cannot open database .../temp/imp_<ver> can't load database backend: 'bsddb'
  • test_imp_3_4_5_zip, test_imp_4_1_3_zip, test_imp_4_2_8_zip, test_imp_5_0_1bsd_zip, test_imp_5_1_2bsd_zip

(Separately, test_WebCal and test_navwebpage in reports_test fail on web-report generation — likely a distinct issue; noted here only for completeness.)

Root cause

  1. The bsddb backend plugin is still registered as STABLE — gramps/plugins/db/bsddb/bsddb.gpr.py (plg.status = STABLE, databaseclass = "DbBsddb").
  2. It imports the underlying lib — gramps/plugins/db/bsddb/bsddb.py:33-35: from berkeleydb.db import ... with fallback from bsddb3.db import .... Neither berkeleydb nor bsddb3 is installed in modern environments, so the import (and thus make_database("bsddb")) fails.
  3. The suite still ships legacy bsddb-format fixtures (imp_3.4.5.zipimp_5.1.2bsd.zip) whose DBBACKEND marker reads bsddb.
  4. db_load() reads the marker, calls make_database("bsddb"), the load fails → the test does assertTrue(False, ...).
  5. The test only skips bsddb on Windowsimports_test.py (~L245): if dbid == "bsddb" and win(): self.skipTest("bsddb not supported on Windows"). There is no equivalent skip when the bsddb backend is simply unavailable on the platform.

Suggested fix

In db_load() (gramps/plugins/test/imports_test.py), skip when the bsddb backend cannot be loaded on any platform — e.g. generalize the existing Windows-only guard to detect an unavailable/unimportable bsddb backend (catch the load failure and self.skipTest(...)), rather than asserting failure. That keeps the legacy-format coverage where bsddb is present while not reddening environments where it has been dropped.

Notes

Not a release blocker for unrelated fixes — environmental. Filed for future work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions