Merge pull request #224 from prculley/movetst

Copy data.gramps to test directory and point db_test at it
This commit is contained in:
Paul Franklin 2016-08-31 15:25:32 +00:00 committed by GitHub
commit 5a8245956c
12 changed files with 67579 additions and 15 deletions

1822
data/tests/data.gramps Normal file

File diff suppressed because it is too large Load Diff

65712
data/tests/example.gramps Normal file

File diff suppressed because it is too large Load Diff

View File

@ -22,10 +22,12 @@
Unittest that tests event-specific filter rules
"""
import unittest
import os
from gramps.gen.merge.diff import import_as_dict
from gramps.cli.user import User
from gramps.gen.filters import GenericFilterFactory
from gramps.gen.const import DATA_DIR
from gramps.gen.filters.rules.event import (
AllEvents, HasType, HasIdOf, HasGallery, RegExpIdOf, HasCitation, HasNote,
@ -33,6 +35,8 @@ from gramps.gen.filters.rules.event import (
MatchesSourceConfidence, HasAttribute, HasData, ChangedSince, HasTag,
HasDayOfWeek)
TEST_DIR = os.path.abspath(os.path.join(DATA_DIR, "tests"))
EXAMPLE = os.path.join(TEST_DIR, "example.gramps")
GenericEventFilter = GenericFilterFactory('Event')
class BaseTest(unittest.TestCase):
@ -45,7 +49,7 @@ class BaseTest(unittest.TestCase):
"""
Import example database.
"""
cls.db = import_as_dict("example/gramps/example.gramps", User())
cls.db = import_as_dict(EXAMPLE, User())
def filter_with_rule(self, rule):
"""

View File

@ -22,10 +22,12 @@
Unittest that tests family-specific filter rules
"""
import unittest
import os
from gramps.gen.merge.diff import import_as_dict
from gramps.cli.user import User
from gramps.gen.filters import GenericFilterFactory
from gramps.gen.const import DATA_DIR
from gramps.gen.filters.rules.family import (
AllFamilies, HasRelType, HasGallery, HasIdOf, HasLDS, HasNote, RegExpIdOf,
@ -35,6 +37,8 @@ from gramps.gen.filters.rules.family import (
MotherHasIdOf, ChildHasNameOf, ChildHasIdOf, ChangedSince, HasTag,
HasTwins, IsAncestorOf, IsDescendantOf)
TEST_DIR = os.path.abspath(os.path.join(DATA_DIR, "tests"))
EXAMPLE = os.path.join(TEST_DIR, "example.gramps")
GenericFamilyFilter = GenericFilterFactory('Family')
class BaseTest(unittest.TestCase):
@ -47,7 +51,7 @@ class BaseTest(unittest.TestCase):
"""
Import example database.
"""
cls.db = import_as_dict("example/gramps/example.gramps", User())
cls.db = import_as_dict(EXAMPLE, User())
def filter_with_rule(self, rule):
"""

View File

@ -22,10 +22,12 @@
Unittest that tests media-specific filter rules
"""
import unittest
import os
from gramps.gen.merge.diff import import_as_dict
from gramps.cli.user import User
from gramps.gen.filters import GenericFilterFactory
from gramps.gen.const import DATA_DIR
from gramps.gen.filters.rules.media import (
AllMedia, HasIdOf, RegExpIdOf, HasCitation, HasNoteRegexp,
@ -33,6 +35,8 @@ from gramps.gen.filters.rules.media import (
HasSourceOf, MediaPrivate, MatchesSourceConfidence, HasMedia,
HasAttribute, ChangedSince, HasTag)
TEST_DIR = os.path.abspath(os.path.join(DATA_DIR, "tests"))
EXAMPLE = os.path.join(TEST_DIR, "example.gramps")
GenericMediaFilter = GenericFilterFactory('Media')
class BaseTest(unittest.TestCase):
@ -45,7 +49,7 @@ class BaseTest(unittest.TestCase):
"""
Import example database.
"""
cls.db = import_as_dict("example/gramps/example.gramps", User())
cls.db = import_as_dict(EXAMPLE, User())
def filter_with_rule(self, rule):
"""

View File

@ -22,15 +22,19 @@
Unittest that tests note-specific filter rules
"""
import unittest
import os
from gramps.gen.merge.diff import import_as_dict
from gramps.cli.user import User
from gramps.gen.filters import GenericFilterFactory
from gramps.gen.const import DATA_DIR
from gramps.gen.filters.rules.note import (
AllNotes, HasIdOf, RegExpIdOf, HasNote, MatchesRegexpOf,
HasReferenceCountOf, NotePrivate, ChangedSince, HasTag, HasType)
TEST_DIR = os.path.abspath(os.path.join(DATA_DIR, "tests"))
EXAMPLE = os.path.join(TEST_DIR, "example.gramps")
GenericNoteFilter = GenericFilterFactory('Note')
class BaseTest(unittest.TestCase):
@ -43,7 +47,7 @@ class BaseTest(unittest.TestCase):
"""
Import example database.
"""
cls.db = import_as_dict("example/gramps/example.gramps", User())
cls.db = import_as_dict(EXAMPLE, User())
def filter_with_rule(self, rule):
"""

View File

@ -22,10 +22,12 @@
Unittest that tests person-specific filter rules
"""
import unittest
import os
from gramps.gen.merge.diff import import_as_dict
from gramps.cli.user import User
from gramps.gen.filters import GenericFilter
from gramps.gen.const import DATA_DIR
from gramps.gen.filters.rules.person import (
Disconnected, Everyone, FamilyWithIncompleteEvent, HasAlternateName,
@ -36,6 +38,9 @@ from gramps.gen.filters.rules.person import (
NoDeathdate, PeoplePrivate, PeoplePublic, PersonWithIncompleteEvent,
RelationshipPathBetweenBookmarks)
TEST_DIR = os.path.abspath(os.path.join(DATA_DIR, "tests"))
EXAMPLE = os.path.join(TEST_DIR, "example.gramps")
class BaseTest(unittest.TestCase):
"""
Person rule tests.
@ -46,7 +51,7 @@ class BaseTest(unittest.TestCase):
"""
Import example database.
"""
cls.db = import_as_dict("example/gramps/example.gramps", User())
cls.db = import_as_dict(EXAMPLE, User())
def filter_with_rule(self, rule):
"""

View File

@ -22,10 +22,12 @@
Unittest that tests place-specific filter rules
"""
import unittest
import os
from gramps.gen.merge.diff import import_as_dict
from gramps.cli.user import User
from gramps.gen.filters import GenericFilterFactory
from gramps.gen.const import DATA_DIR
from gramps.gen.filters.rules.place import (
AllPlaces, HasCitation, HasGallery, HasIdOf, RegExpIdOf, HasNote,
@ -33,6 +35,8 @@ from gramps.gen.filters.rules.place import (
PlacePrivate, MatchesSourceConfidence, HasData, HasNoLatOrLon,
InLatLonNeighborhood, ChangedSince, HasTag, HasTitle, IsEnclosedBy)
TEST_DIR = os.path.abspath(os.path.join(DATA_DIR, "tests"))
EXAMPLE = os.path.join(TEST_DIR, "example.gramps")
GenericPlaceFilter = GenericFilterFactory('Place')
class BaseTest(unittest.TestCase):
@ -45,7 +49,7 @@ class BaseTest(unittest.TestCase):
"""
Import example database.
"""
cls.db = import_as_dict("example/gramps/example.gramps", User())
cls.db = import_as_dict(EXAMPLE, User())
def filter_with_rule(self, rule):
"""

View File

@ -22,15 +22,19 @@
Unittest that tests repository-specific filter rules
"""
import unittest
import os
from gramps.gen.merge.diff import import_as_dict
from gramps.cli.user import User
from gramps.gen.filters import GenericFilterFactory
from gramps.gen.const import DATA_DIR
from gramps.gen.filters.rules.repository import (
AllRepos, HasIdOf, RegExpIdOf, HasNoteRegexp, HasReferenceCountOf,
RepoPrivate, ChangedSince, MatchesNameSubstringOf, HasTag)
TEST_DIR = os.path.abspath(os.path.join(DATA_DIR, "tests"))
EXAMPLE = os.path.join(TEST_DIR, "example.gramps")
GenericRepositoryFilter = GenericFilterFactory('Repository')
class BaseTest(unittest.TestCase):
@ -43,7 +47,7 @@ class BaseTest(unittest.TestCase):
"""
Import example database.
"""
cls.db = import_as_dict("example/gramps/example.gramps", User())
cls.db = import_as_dict(EXAMPLE, User())
def filter_with_rule(self, rule):
"""

View File

@ -21,6 +21,7 @@
""" Unittest for to_struct, from_struct """
import unittest
import os
from .. import (Person, Family, Event, Source, Place, Citation,
Repository, Media, Note, Tag)
@ -28,6 +29,10 @@ from gramps.gen.lib.struct import Struct
from gramps.gen.merge.diff import import_as_dict
from gramps.cli.user import User
from gramps.gen.merge.diff import *
from gramps.gen.const import DATA_DIR
TEST_DIR = os.path.abspath(os.path.join(DATA_DIR, "tests"))
EXAMPLE = os.path.join(TEST_DIR, "example.gramps")
class BaseCheck:
def test_from_struct(self):
@ -108,7 +113,7 @@ def generate_case(obj):
#name = "test_create_%s_%s" % (obj.__class__.__name__, obj.handle)
#setattr(DatabaseCheck, name, test2)
db = import_as_dict("example/gramps/example.gramps", User())
db = import_as_dict(EXAMPLE, User())
for table in db.get_table_func():
for handle in db.get_table_func(table,"handles_func")():
obj = db.get_table_func(table,"handle_func")(handle)

View File

@ -49,10 +49,6 @@ class MockEditReference(EditReference):
self.window = MockWindow()
super().__init__(dbstate, uistate, track, source, source_ref, update)
example = os.path.abspath(
os.path.join(os.path.dirname(os.path.abspath(__file__)),
"../../../..",
"example/gramps/example.gramps"))
class TestEditReference(unittest.TestCase):

View File

@ -24,10 +24,10 @@ import os
from gramps.test.test_util import Gramps
from gramps.gen.db import open_database
from gramps.gen.lib import *
from gramps.gen.const import DATA_DIR
ddir = os.path.dirname(__file__)
example = os.path.join(ddir, "..", "..", "..", "..",
"example", "gramps", "data.gramps")
TEST_DIR = os.path.abspath(os.path.join(DATA_DIR, "tests"))
example = os.path.join(TEST_DIR, "data.gramps")
class BSDDB:
NAME = "Example BSDDB Test"