1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-21 14:53:44 +03:00

python/tests: open() relative to test scripts

This commit is contained in:
David Seifert
2022-03-30 22:00:50 +02:00
parent 5c71ada83a
commit 0137d9879b
2 changed files with 7 additions and 2 deletions

View File

@@ -5,6 +5,7 @@
#
import sys
import glob
import os
import string
import libxml2
try:
@@ -18,7 +19,8 @@ except:
libxml2.debugMemory(1)
err = ""
dir_prefix = "../../test/valid/"
basedir = os.path.dirname(os.path.realpath(__file__))
dir_prefix = os.path.join(basedir, "../../test/valid/")
# This dictionary reflects the contents of the files
# ../../test/valid/*.xml.err that are not empty, except that
# the file paths in the messages start with ../../test/
@@ -125,6 +127,7 @@ parsing_error_files = ["766956", "cond_sect2", "t8", "t8a"]
expect_parsing_error = ["{}{}.xml".format(dir_prefix, f) for f in parsing_error_files]
valid_files = glob.glob(dir_prefix + "*.x*")
assert valid_files, "found no valid files in '{}'".format(dir_prefix)
valid_files.sort()
for file in valid_files:
err = ""

View File

@@ -4,6 +4,7 @@
# this extract the Dragon bibliography entries from the XML specification
#
import libxml2
import os
import sys
# Memory debug specific
@@ -14,7 +15,8 @@ Ravi Sethi, and Jeffrey D. Ullman.
<emph>Compilers: Principles, Techniques, and Tools</emph>.
Reading: Addison-Wesley, 1986, rpt. corr. 1988.</bibl>"""
f = open('../../test/valid/REC-xml-19980210.xml', 'rb')
basedir = os.path.dirname(os.path.realpath(__file__))
f = open(os.path.join(basedir, '../../test/valid/REC-xml-19980210.xml'), 'rb')
input = libxml2.inputBuffer(f)
reader = input.newTextReader("REC")
res=""