Fix and move CLI unit test
svn: r22754
This commit is contained in:
parent
183e985747
commit
b7c5c77676
0
gramps/cli/test/__init__.py
Normal file
0
gramps/cli/test/__init__.py
Normal file
@ -18,7 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
# test/gramps_cli_test.py
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
""" CLI tests for gramps """
|
""" CLI tests for gramps """
|
||||||
@ -27,11 +26,6 @@ import os
|
|||||||
import unittest
|
import unittest
|
||||||
import re
|
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
|
test_ged = """0 HEAD
|
||||||
1 SOUR min1r.ged min 1-rec
|
1 SOUR min1r.ged min 1-rec
|
||||||
1 SUBM @SUBM1@
|
1 SUBM @SUBM1@
|
||||||
@ -42,10 +36,11 @@ test_ged = """0 HEAD
|
|||||||
0 @I1@ INDI
|
0 @I1@ INDI
|
||||||
0 TRLR
|
0 TRLR
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
ddir = os.path.dirname(__file__)
|
||||||
min1r = os.path.join(ddir,"min1r.ged")
|
min1r = os.path.join(ddir,"min1r.ged")
|
||||||
out_ged = os.path.join(ddir,"test_out.ged")
|
out_ged = os.path.join(ddir,"test_out.ged")
|
||||||
|
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
if not os.path.exists(min1r):
|
if not os.path.exists(min1r):
|
||||||
@ -65,9 +60,9 @@ class Test(unittest.TestCase):
|
|||||||
def test2_exec_CLI(self):
|
def test2_exec_CLI(self):
|
||||||
ifile = min1r
|
ifile = min1r
|
||||||
ofile = out_ged
|
ofile = out_ged
|
||||||
gcmd = "./gramps.py -i%s -o%s" % (ifile, ofile)
|
gcmd = "Gramps.py -i %s -e %s" % (ifile, ofile)
|
||||||
rc = os.system("cd %s && python %s" % (pdir, gcmd))
|
rc = os.system("python %s" % gcmd)
|
||||||
self.assertEquals(rc,0, tu.msg(rc,0, "executed CLI cmmand %r" % gcmd))
|
self.assertEquals(rc, 0, "executed CLI cmmand %r" % gcmd)
|
||||||
# simple validation o output
|
# simple validation o output
|
||||||
self.assertTrue(os.path.isfile(ofile), "output file created")
|
self.assertTrue(os.path.isfile(ofile), "output file created")
|
||||||
content = open(ofile).read()
|
content = open(ofile).read()
|
||||||
@ -89,9 +84,9 @@ class Test(unittest.TestCase):
|
|||||||
# ~same as test 2
|
# ~same as test 2
|
||||||
ifile = min1r
|
ifile = min1r
|
||||||
ofile = out_ged
|
ofile = out_ged
|
||||||
gcmd = "./gramps.py -i%s -o%s" % (ifile, ofile)
|
gcmd = "Gramps.py -i %s -e %s" % (ifile, ofile)
|
||||||
rc = os.system("cd %s && python %s" % (pdir, gcmd))
|
rc = os.system("python %s" % gcmd)
|
||||||
self.assertEquals(rc,0, tu.msg(rc,0, "executed CLI cmmand %r" % gcmd))
|
self.assertEquals(rc, 0, "executed CLI cmmand %r" % gcmd)
|
||||||
|
|
||||||
for fn in bogofiles:
|
for fn in bogofiles:
|
||||||
self.assertFalse(os.path.exists(fn))
|
self.assertFalse(os.path.exists(fn))
|
Loading…
Reference in New Issue
Block a user