Make copy of example.gramps to tests dir and point test modules to it
This commit is contained in:
parent
70404e1931
commit
e3b482dd57
65712
data/tests/example.gramps
Normal file
65712
data/tests/example.gramps
Normal file
File diff suppressed because it is too large
Load Diff
@ -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):
|
||||
"""
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -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)
|
||||
|
@ -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):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user