コード例 #1
0
ファイル: exports_test.py プロジェクト: jakirkham/gramps
def call(*args):
    """ Call Gramps to perform the action with out and err captured """
    print("call:", args)
    gramps = Gramps(user=User())
    out, err = gramps.run(*args)
    print("out:", out, "err:", err)
    return out, err
コード例 #2
0
ファイル: test_exports.py プロジェクト: pat49/gramps
def call(*args):
    """ Call Gramps to perform the action with out and err captured """
    print("call:", args)
    gramps = Gramps(user=User(auto_accept=True, quiet=True))
    out, err = gramps.run(*args)
    print("out:", out, "err:", err)
    return out, err
コード例 #3
0
ファイル: exports_test.py プロジェクト: SNoiraud/gramps
def call(*args):
    """ Call Gramps to perform the action with out and err captured """
    #print("call:", args)
    gramps = Gramps(user=User())
    out, err = gramps.run(*args)
    #print("out:", out, "err:", err)
    return out, err
コード例 #4
0
def call(*args):
    """ Call Gramps to perform the action with out and err captured """
    if __debug__:
        print("call: %s", args)
    gramps = Gramps(user=User(auto_accept=True, quiet=True))
    # gramps = Gramps(user=User(auto_accept=True))
    out, err = gramps.run(*args)
    # print("out:", out, "err:", err)
    return out, err
コード例 #5
0
class ReportControl:
    def tearDown(self):
        out, err = self.call("-y", "--remove", TREE_NAME)
        out, err = self.call("-y", "--remove", TREE_NAME + "_import_gedcom")

    def call(self, *args):
        print("call:", args)
        self.gramps = Gramps()
        out, err = self.gramps.run(*args)
        print("out:", out, "err:", err)
        return out, err

    def __init__(self):
        super().__init__()
        self.tearDown()  # removes it if it existed
        out, err = self.call("-C", TREE_NAME, "--import", example)
        db = open_database(TREE_NAME, force_unlock=True)
        db.Person.filter(lambda person: person.gramps_id == "I0000").tag(
            "Cool")
        db.close()

    def addreport(self, class_, report_name, test_function, files, **options):
        test_name = report_name.replace("-", "_")
        setattr(
            class_, test_name,
            dynamic_report_method(report_name, test_function, files, "--force",
                                  "-O", TREE_NAME, "--action", "report",
                                  "--options", "name=%s" % report_name,
                                  **options))

    def addcli(self, class_, report_name, test_function, files, *args,
               **options):
        test_name = report_name.replace("-", "_")
        setattr(class_, test_name,
                dynamic_cli_method(report_name, test_function, files, *args))
コード例 #6
0
class ReportControl:
    def tearDown(self):
        out, err = self.call("-y", "--remove", TREE_NAME)
        # out, err = self.call("-y", "--remove", TREE_NAME + "_import_gedcom")

    def call(self, *args):
        #print("call:", args)
        self.gramps = Gramps(user=User())
        out, err = self.gramps.run(*args)
        #print("out:", out, "err:", err)
        return out, err

    def __init__(self):
        super().__init__()
        self.tearDown()  # removes it if it existed
        out, err = self.call("-C", TREE_NAME, "--import", example)

    def addreport(self, class_, report_name, test_function, files, **options):
        test_name = "test_" + report_name.replace("-", "_")
        setattr(
            class_, test_name,
            dynamic_report_method(report_name, test_function, files, "--force",
                                  "-O", TREE_NAME, "--action", "report",
                                  "--options", "name=%s" % report_name,
                                  **options))

    def addcli(self, class_, report_name, test_function, files, *args,
               **options):
        test_name = "test_" + report_name.replace("-", "_")
        setattr(
            class_, test_name,
            dynamic_cli_method(report_name, test_function, files, *args,
                               **options))
コード例 #7
0
ファイル: cli_test.py プロジェクト: tiansworld/gramps
class CLITest(unittest.TestCase):
    def tearDown(self):
        if os.path.exists(example_copy):
            os.remove(example_copy)
        self.call("--remove", "Test: test1_cli")

    def setUp(self):
        self.gramps = Gramps()
        self.tearDown()

    def call(self, *args, stdin=None):
        self.gramps.run(*args, stdin=stdin)

    def test1a_cli(self):
        self.call("-C", "Test: test1_cli", "--import", example)

    def test1b_cli(self):
        self.call("-O", "Test: test1_cli", "--export", example_copy)
コード例 #8
0
ファイル: cli_test.py プロジェクト: SNoiraud/gramps
class CLITest(unittest.TestCase):
    def tearDown(self):
        if os.path.exists(example_copy):
            os.remove(example_copy)
        self.call("--remove", "Test: test1_cli")

    def setUp(self):
        self.gramps = Gramps()
        self.tearDown()

    def call(self, *args, stdin=None):
        self.gramps.run(*args, stdin=stdin)

    def test1a_cli(self):
        self.call("-C", "Test: test1_cli", "--import", example)

    def test1b_cli(self):
        self.call("-O", "Test: test1_cli", "--export", example_copy)
コード例 #9
0
class BSDDB:
    NAME = "Example BSDDB Test"
    backend = "bsddb"

    def __init__(self):
        self.gramps = Gramps()
        self.call("--config=database.backend:" + self.backend, "-C", self.NAME,
                  "--import", example)
        self.db = open_database(self.NAME, force_unlock=True)

    def call(self, *args, stdin=None):
        return self.gramps.run(*args, stdin=stdin)

    def close(self):
        self.db.close()
        self.call("-r", self.NAME)
コード例 #10
0
ファイル: db_test.py プロジェクト: bigalexstrong/gramps
class BSDDB(object):
    NAME = "Example BSDDB Test"
    backend = "bsddb"

    def __init__(self):
        self.gramps = Gramps()
        self.call("--config=behavior.database-backend:" + self.backend,
                  "-C", self.NAME, "--import", example)
        self.db = open_database(self.NAME, force_unlock=True)

    def call(self, *args, stdin=None):
        return self.gramps.run(*args, stdin=stdin)

    def close(self):
        self.db.close()
        self.call("-r", self.NAME)
コード例 #11
0
ファイル: test_reports.py プロジェクト: DaAwesomeP/gramps
class ReportControl(object):
    def tearDown(self):
        out, err = self.call("-y", "--remove", TREE_NAME)

    def call(self, *args):
        print("call:", args)
        self.gramps = Gramps()
        out, err = self.gramps.run(*args)
        print("out:", out, "err:", err)
        return out, err

    def __init__(self):
        super().__init__()
        self.tearDown() # removes it if it existed
        out, err = self.call("-C", TREE_NAME, 
                             "--import", example)
        out, err = self.call("-O", TREE_NAME, 
                             "--action", "report", 
                             "--options", "show=all")
        self.reports = []
        for line in err.split("\n"):
            if line.startswith("   "):
                report_name, description = line.split("- ", 1)
                self.reports.append(report_name.strip())

    def testall(self, class_):
        count = 0
        print(self.reports)
        for report_name in self.reports:
            print("add attr:", report_name)
            setattr(class_, "test_%s" % count, dynamic_method(
                "--force",
                "-O", TREE_NAME, 
                "--action", "report", 
                "--options", "name=%s" % report_name))
            count += 1

    def addtest(self, class_, report_name, test_function, options):
        test_name = report_name.replace("-", "_")
        setattr(class_, test_name, dynamic_method(
            report_name,
            test_function,
            "--force",
            "-O", TREE_NAME, 
            "--action", "report", 
            "--options", "name=%s,%s" % (report_name, options)))
コード例 #12
0
ファイル: test_reports.py プロジェクト: belissent/gramps
class ReportControl:
    def tearDown(self):
        out, err = self.call("-y", "--remove", TREE_NAME)
        out, err = self.call("-y", "--remove", TREE_NAME + "_import_gedcom")

    def call(self, *args):
        print("call:", args)
        self.gramps = Gramps()
        out, err = self.gramps.run(*args)
        print("out:", out, "err:", err)
        return out, err

    def __init__(self):
        super().__init__()
        self.tearDown() # removes it if it existed
        out, err = self.call("-C", TREE_NAME,
                             "--import", example)
        db = open_database(TREE_NAME, force_unlock=True)
        db.Person.filter(lambda person: person.gramps_id == "I0000").tag("Cool")
        db.close()

    def addreport(self, class_, report_name, test_function,
                  files, **options):
        test_name = report_name.replace("-", "_")
        setattr(class_, test_name, dynamic_report_method(
            report_name,
            test_function,
            files,
            "--force",
            "-O", TREE_NAME,
            "--action", "report",
            "--options", "name=%s" % report_name,
            **options))

    def addcli(self, class_, report_name, test_function,
               files, *args, **options):
        test_name = report_name.replace("-", "_")
        setattr(class_, test_name,
                dynamic_cli_method(
                    report_name,
                    test_function,
                    files,
                    *args))
コード例 #13
0
 def call(cls, *args):
     #print("call:", args)
     gramps = Gramps(user=User())
     out, err = gramps.run(*args)
     #print("out:", out, "err:", err)
     return out, err
コード例 #14
0
ファイル: db_test.py プロジェクト: bigalexstrong/gramps
 def __init__(self):
     self.gramps = Gramps()
     self.call("--config=behavior.database-backend:" + self.backend,
               "-C", self.NAME, "--import", example)
     self.db = open_database(self.NAME, force_unlock=True)
コード例 #15
0
 def call(self, *args):
     #print("call:", args)
     self.gramps = Gramps(user=User())
     out, err = self.gramps.run(*args)
     #print("out:", out, "err:", err)
     return out, err
コード例 #16
0
 def __init__(self):
     self.gramps = Gramps()
     self.call("--config=database.backend:" + self.backend, "-C", self.NAME,
               "--import", example)
     self.db = open_database(self.NAME, force_unlock=True)
コード例 #17
0
ファイル: cli_test.py プロジェクト: SNoiraud/gramps
 def setUp(self):
     self.gramps = Gramps()
     self.tearDown()
コード例 #18
0
ファイル: test_reports.py プロジェクト: belissent/gramps
 def call(self, *args):
     print("call:", args)
     self.gramps = Gramps()
     out, err = self.gramps.run(*args)
     print("out:", out, "err:", err)
     return out, err
コード例 #19
0
ファイル: test_reports.py プロジェクト: belissent/gramps
 def call(cls, *args):
     print("call:", args)
     gramps = Gramps()
     out, err = gramps.run(*args)
     print("out:", out, "err:", err)
     return out, err
コード例 #20
0
ファイル: cli_test.py プロジェクト: tiansworld/gramps
 def setUp(self):
     self.gramps = Gramps()
     self.tearDown()
コード例 #21
0
 def call(cls, *args):
     print("call:", args)
     gramps = Gramps()
     out, err = gramps.run(*args)
     print("out:", out, "err:", err)
     return out, err
コード例 #22
0
 def call(self, *args):
     print("call:", args)
     self.gramps = Gramps()
     out, err = self.gramps.run(*args)
     print("out:", out, "err:", err)
     return out, err