Fix and move CLI unit test

svn: r22755
This commit is contained in:
Nick Hall 2013-07-28 16:20:30 +00:00
parent b2b4da2d37
commit 696ee7aad0
2 changed files with 8 additions and 13 deletions

View File

View File

@ -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))