Use new test framework; remove Test db
This commit is contained in:
parent
01ef775491
commit
fc55aba6b3
@ -19,8 +19,6 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
import tempfile
|
|
||||||
import shutil
|
|
||||||
|
|
||||||
from .. import DbBsddb, DbTxn
|
from .. import DbBsddb, DbTxn
|
||||||
from gramps.cli.clidbman import CLIDbManager
|
from gramps.cli.clidbman import CLIDbManager
|
||||||
@ -35,16 +33,16 @@ class GrampsDbBaseTest(unittest.TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
def dummy_callback(dummy):
|
def dummy_callback(dummy):
|
||||||
pass
|
pass
|
||||||
self._tmpdir = tempfile.mkdtemp()
|
|
||||||
|
|
||||||
self._db = DbBsddb()
|
self.dbstate = DbState()
|
||||||
dbman = CLIDbManager(DbState())
|
self.dbman = CLIDbManager(self.dbstate)
|
||||||
self._filename, title = dbman.create_new_db_cli(title="Test")
|
dirpath, name = self.dbman.create_new_db_cli("Test: bsddb", dbid="bsddb")
|
||||||
self._db.load(self._filename, dummy_callback, "w")
|
self._db = self.dbstate.make_database("bsddb")
|
||||||
|
self._db.load(dirpath, None)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self._db.close()
|
self._db.close()
|
||||||
shutil.rmtree(self._tmpdir)
|
self.dbman.remove_database("Test: bsddb")
|
||||||
|
|
||||||
def _populate_database(self,
|
def _populate_database(self,
|
||||||
num_sources = 1,
|
num_sources = 1,
|
||||||
@ -54,10 +52,9 @@ class GrampsDbBaseTest(unittest.TestCase):
|
|||||||
num_places = 0,
|
num_places = 0,
|
||||||
num_media_objects = 0,
|
num_media_objects = 0,
|
||||||
num_links = 1):
|
num_links = 1):
|
||||||
|
|
||||||
# start with sources
|
# start with sources
|
||||||
sources = []
|
sources = []
|
||||||
for i in xrange(0, num_sources):
|
for i in range(num_sources):
|
||||||
sources.append(self._add_source())
|
sources.append(self._add_source())
|
||||||
|
|
||||||
# now for each of the other tables. Give each entry a link
|
# 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)):
|
(num_media_objects, self._add_media_object_with_sources)):
|
||||||
|
|
||||||
source_idx = 1
|
source_idx = 1
|
||||||
for person_idx in xrange(0, num):
|
for person_idx in range(num):
|
||||||
|
|
||||||
# Get the list of sources to link
|
# Get the list of sources to link
|
||||||
lnk_sources = set()
|
lnk_sources = set()
|
||||||
for i in xrange(0, num_links):
|
for i in range(num_links):
|
||||||
lnk_sources.add(sources[source_idx-1])
|
lnk_sources.add(sources[source_idx-1])
|
||||||
source_idx = (source_idx+1) % len(sources)
|
source_idx = (source_idx+1) % len(sources)
|
||||||
|
|
||||||
|
@ -150,6 +150,9 @@ class ReferenceMapTest(GrampsDbBaseTest):
|
|||||||
"len(references) == %s " % str(len(references)))
|
"len(references) == %s " % str(len(references)))
|
||||||
|
|
||||||
def perf_simple_search_speed(self):
|
def perf_simple_search_speed(self):
|
||||||
|
"""
|
||||||
|
This doesn't work any more due to multiply inheritance changes.
|
||||||
|
"""
|
||||||
|
|
||||||
num_sources = 100
|
num_sources = 100
|
||||||
num_persons = 1000
|
num_persons = 1000
|
||||||
|
Loading…
Reference in New Issue
Block a user