From b7c5c776768db7f0540b5cb6cf96a76d21c0da4c Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Sun, 28 Jul 2013 16:20:14 +0000 Subject: [PATCH] Fix and move CLI unit test svn: r22754 --- gramps/cli/test/__init__.py | 0 .../test/cli_test.py} | 21 +++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) create mode 100644 gramps/cli/test/__init__.py rename gramps/{test/gramps_cli_test.py => cli/test/cli_test.py} (84%) diff --git a/gramps/cli/test/__init__.py b/gramps/cli/test/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/gramps/test/gramps_cli_test.py b/gramps/cli/test/cli_test.py similarity index 84% rename from gramps/test/gramps_cli_test.py rename to gramps/cli/test/cli_test.py index b71ee19f4..b7999a6dc 100644 --- a/gramps/test/gramps_cli_test.py +++ b/gramps/cli/test/cli_test.py @@ -18,7 +18,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# test/gramps_cli_test.py # $Id$ """ CLI tests for gramps """ @@ -27,11 +26,6 @@ import os import unittest import re -from .test import test_util as tu - -pdir = tu.path_append_parent() -ddir = tu.make_subdir( "cli_test_data") - test_ged = """0 HEAD 1 SOUR min1r.ged min 1-rec 1 SUBM @SUBM1@ @@ -42,10 +36,11 @@ test_ged = """0 HEAD 0 @I1@ INDI 0 TRLR """ + +ddir = os.path.dirname(__file__) min1r = os.path.join(ddir,"min1r.ged") out_ged = os.path.join(ddir,"test_out.ged") - class Test(unittest.TestCase): def setUp(self): if not os.path.exists(min1r): @@ -65,9 +60,9 @@ class Test(unittest.TestCase): def test2_exec_CLI(self): ifile = min1r ofile = out_ged - gcmd = "./gramps.py -i%s -o%s" % (ifile, ofile) - rc = os.system("cd %s && python %s" % (pdir, gcmd)) - self.assertEquals(rc,0, tu.msg(rc,0, "executed CLI cmmand %r" % gcmd)) + gcmd = "Gramps.py -i %s -e %s" % (ifile, ofile) + rc = os.system("python %s" % gcmd) + self.assertEquals(rc, 0, "executed CLI cmmand %r" % gcmd) # simple validation o output self.assertTrue(os.path.isfile(ofile), "output file created") content = open(ofile).read() @@ -89,9 +84,9 @@ class Test(unittest.TestCase): # ~same as test 2 ifile = min1r ofile = out_ged - gcmd = "./gramps.py -i%s -o%s" % (ifile, ofile) - rc = os.system("cd %s && python %s" % (pdir, gcmd)) - self.assertEquals(rc,0, tu.msg(rc,0, "executed CLI cmmand %r" % gcmd)) + gcmd = "Gramps.py -i %s -e %s" % (ifile, ofile) + rc = os.system("python %s" % gcmd) + self.assertEquals(rc, 0, "executed CLI cmmand %r" % gcmd) for fn in bogofiles: self.assertFalse(os.path.exists(fn))