Remove superfluous console output in unit tests
svn: r22779
This commit is contained in:
parent
4acc6e262e
commit
71143f6d0d
@ -42,9 +42,13 @@ from gramps.plugins.export.exportvcard import VCardWriter
|
|||||||
|
|
||||||
class VCardCheck(unittest.TestCase):
|
class VCardCheck(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.expect = ["BEGIN:VCARD", "VERSION:3.0", "PRODID:-//Gramps//NONSGML Gramps %s//EN" % VERSION, "FN:Lastname", "N:Lastname;;;;", "SORT-STRING:" + "Lastname".ljust(55), "END:VCARD"]
|
self.expect = ["BEGIN:VCARD", "VERSION:3.0",
|
||||||
|
"PRODID:-//Gramps//NONSGML Gramps %s//EN" % VERSION,
|
||||||
|
"FN:Lastname", "N:Lastname;;;;",
|
||||||
|
"SORT-STRING:" + "Lastname".ljust(55), "END:VCARD"]
|
||||||
date = time.localtime(time.time())
|
date = time.localtime(time.time())
|
||||||
self.input_list = ["BEGIN:VCARD", "VERSION:3.0", "FN:Lastname", "N:Lastname;;;;", "END:VCARD"]
|
self.input_list = ["BEGIN:VCARD", "VERSION:3.0", "FN:Lastname",
|
||||||
|
"N:Lastname;;;;", "END:VCARD"]
|
||||||
strng = """<?xml version="1.0" encoding="UTF-8"?>
|
strng = """<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE database PUBLIC "-//GRAMPS//DTD GRAMPS XML %s//EN"
|
<!DOCTYPE database PUBLIC "-//GRAMPS//DTD GRAMPS XML %s//EN"
|
||||||
"http://gramps-project.org/xml/%s/grampsxml.dtd">
|
"http://gramps-project.org/xml/%s/grampsxml.dtd">
|
||||||
@ -77,12 +81,15 @@ class VCardCheck(unittest.TestCase):
|
|||||||
if debug:
|
if debug:
|
||||||
print(input_strfile.getvalue())
|
print(input_strfile.getvalue())
|
||||||
|
|
||||||
process = subprocess.Popen('python Gramps.py -i - -f gramps -e - -f vcf',
|
process = subprocess.Popen('python Gramps.py '
|
||||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
|
'-i - -f gramps -e - -f vcf',
|
||||||
|
stdin=subprocess.PIPE,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
shell=True)
|
||||||
result_str, err_str = process.communicate(input_strfile.getvalue())
|
result_str, err_str = process.communicate(input_strfile.getvalue())
|
||||||
if err_str:
|
|
||||||
print(err_str)
|
|
||||||
if debug:
|
if debug:
|
||||||
|
print(err_str)
|
||||||
print(result_str)
|
print(result_str)
|
||||||
print(expect_str)
|
print(expect_str)
|
||||||
self.assertEqual(result_str, expect_str)
|
self.assertEqual(result_str, expect_str)
|
||||||
@ -99,10 +106,12 @@ class VCardCheck(unittest.TestCase):
|
|||||||
"backslash\\\\_comma\\,_semicolon\\;")
|
"backslash\\\\_comma\\,_semicolon\\;")
|
||||||
|
|
||||||
def test_esc_string_list(self):
|
def test_esc_string_list(self):
|
||||||
self.assertEqual(VCardWriter.esc(["comma,", "semicolon;"]),["comma\\,", "semicolon\\;"])
|
self.assertEqual(VCardWriter.esc(["comma,", "semicolon;"]),
|
||||||
|
["comma\\,", "semicolon\\;"])
|
||||||
|
|
||||||
def test_esc_string_tuple(self):
|
def test_esc_string_tuple(self):
|
||||||
self.assertEqual(VCardWriter.esc(("comma,", "semicolon;")),("comma\\,", "semicolon\\;"))
|
self.assertEqual(VCardWriter.esc(("comma,", "semicolon;")),
|
||||||
|
("comma\\,", "semicolon\\;"))
|
||||||
|
|
||||||
def test_esc_string_wrongtype(self):
|
def test_esc_string_wrongtype(self):
|
||||||
self.assertRaises(TypeError, VCardWriter.esc,
|
self.assertRaises(TypeError, VCardWriter.esc,
|
||||||
|
@ -98,16 +98,19 @@ class VCardCheck(unittest.TestCase):
|
|||||||
self.string2canonicalxml(expect_str, buf)
|
self.string2canonicalxml(expect_str, buf)
|
||||||
|
|
||||||
process = subprocess.Popen('python Gramps.py '
|
process = subprocess.Popen('python Gramps.py '
|
||||||
'--config=preferences.eprefix:DEFAULT -i - -f vcf -e - -f gramps',
|
'--config=preferences.eprefix:DEFAULT '
|
||||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
|
'-i - -f vcf -e - -f gramps',
|
||||||
|
stdin=subprocess.PIPE,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
shell=True)
|
||||||
result_str, err_str = process.communicate(input_str)
|
result_str, err_str = process.communicate(input_str)
|
||||||
if err_str:
|
|
||||||
print(err_str)
|
|
||||||
result_canonical_strfile = StringIO()
|
result_canonical_strfile = StringIO()
|
||||||
buf2 = libxml2.createOutputBuffer(result_canonical_strfile, 'UTF-8')
|
buf2 = libxml2.createOutputBuffer(result_canonical_strfile, 'UTF-8')
|
||||||
self.string2canonicalxml(result_str, buf2)
|
self.string2canonicalxml(result_str, buf2)
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
|
print(err_str)
|
||||||
print(result_canonical_strfile.getvalue())
|
print(result_canonical_strfile.getvalue())
|
||||||
print(expect_canonical_strfile.getvalue())
|
print(expect_canonical_strfile.getvalue())
|
||||||
self.assertEqual(result_canonical_strfile.getvalue(),
|
self.assertEqual(result_canonical_strfile.getvalue(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user