From fc55aba6b3bf4589c697dbfa4ed2325db6baa237 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Fri, 18 Dec 2015 09:09:27 -0500 Subject: [PATCH] Use new test framework; remove Test db --- .../bsddb_support/test/grampsdbtestbase.py | 21 ++++++++----------- .../bsddb_support/test/reference_map_test.py | 3 +++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gramps/plugins/database/bsddb_support/test/grampsdbtestbase.py b/gramps/plugins/database/bsddb_support/test/grampsdbtestbase.py index 02ed1b2a4..201d54ede 100644 --- a/gramps/plugins/database/bsddb_support/test/grampsdbtestbase.py +++ b/gramps/plugins/database/bsddb_support/test/grampsdbtestbase.py @@ -19,8 +19,6 @@ # import unittest -import tempfile -import shutil from .. import DbBsddb, DbTxn from gramps.cli.clidbman import CLIDbManager @@ -35,16 +33,16 @@ class GrampsDbBaseTest(unittest.TestCase): def setUp(self): def dummy_callback(dummy): pass - self._tmpdir = tempfile.mkdtemp() - self._db = DbBsddb() - dbman = CLIDbManager(DbState()) - self._filename, title = dbman.create_new_db_cli(title="Test") - self._db.load(self._filename, dummy_callback, "w") + self.dbstate = DbState() + self.dbman = CLIDbManager(self.dbstate) + dirpath, name = self.dbman.create_new_db_cli("Test: bsddb", dbid="bsddb") + self._db = self.dbstate.make_database("bsddb") + self._db.load(dirpath, None) def tearDown(self): self._db.close() - shutil.rmtree(self._tmpdir) + self.dbman.remove_database("Test: bsddb") def _populate_database(self, num_sources = 1, @@ -54,10 +52,9 @@ class GrampsDbBaseTest(unittest.TestCase): num_places = 0, num_media_objects = 0, num_links = 1): - # start with sources sources = [] - for i in xrange(0, num_sources): + for i in range(num_sources): sources.append(self._add_source()) # now for each of the other tables. Give each entry a link @@ -71,11 +68,11 @@ class GrampsDbBaseTest(unittest.TestCase): (num_media_objects, self._add_media_object_with_sources)): source_idx = 1 - for person_idx in xrange(0, num): + for person_idx in range(num): # Get the list of sources to link lnk_sources = set() - for i in xrange(0, num_links): + for i in range(num_links): lnk_sources.add(sources[source_idx-1]) source_idx = (source_idx+1) % len(sources) diff --git a/gramps/plugins/database/bsddb_support/test/reference_map_test.py b/gramps/plugins/database/bsddb_support/test/reference_map_test.py index e726eeaaf..1d96f28cd 100644 --- a/gramps/plugins/database/bsddb_support/test/reference_map_test.py +++ b/gramps/plugins/database/bsddb_support/test/reference_map_test.py @@ -150,6 +150,9 @@ class ReferenceMapTest(GrampsDbBaseTest): "len(references) == %s " % str(len(references))) def perf_simple_search_speed(self): + """ + This doesn't work any more due to multiply inheritance changes. + """ num_sources = 100 num_persons = 1000