mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-07-12 01:41:46 +03:00
refactored make tests, make all now don't run the test suite added tests
* Makefile.am configure.in tests/Makefile.am tests/*/Makefile.am tests/*/*/Makefile.am: refactored make tests, make all now don't run the test suite * python/Makefile.am: added tests * python/tests/basic.py python/tests/Makefile.am: added the first basic test, memory debug included Daniel
This commit is contained in:
27
python/tests/Makefile.am
Normal file
27
python/tests/Makefile.am
Normal file
@ -0,0 +1,27 @@
|
||||
EXAMPLE_DIR = $(prefix)/share/doc/libxslt-python-$(LIBXML_VERSION)/examples
|
||||
|
||||
TESTS= \
|
||||
basic.py
|
||||
|
||||
XMLS= \
|
||||
test.xml \
|
||||
test.xsl
|
||||
|
||||
EXTRA_DIST = $(TESTS) $(XMLS)
|
||||
|
||||
if WITH_PYTHON
|
||||
tests: $(TESTS)
|
||||
-@(PYTHONPATH=".." ; export PYTHONPATH; \
|
||||
for test in $(TESTS) ; do echo "-- $$test" ; $(PYTHON) $$test ; done)
|
||||
else
|
||||
tests:
|
||||
endif
|
||||
|
||||
clean:
|
||||
rm -f *.pyc core
|
||||
|
||||
install-data-local:
|
||||
$(mkinstalldirs) $(DESTDIR)$(EXAMPLE_DIR)
|
||||
-(for test in $(TESTS) $(XMLS); \
|
||||
do @INSTALL@ -m 0644 $$test $(DESTDIR)$(EXAMPLE_DIR) ; done)
|
||||
|
25
python/tests/basic.py
Executable file
25
python/tests/basic.py
Executable file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/python -u
|
||||
import libxml2
|
||||
import libxslt
|
||||
|
||||
# Memory debug specific
|
||||
libxml2.debugMemory(1)
|
||||
|
||||
|
||||
styledoc = libxml2.parseFile("test.xsl")
|
||||
style = libxslt.parseStylesheetDoc(styledoc)
|
||||
doc = libxml2.parseFile("test.xml")
|
||||
result = style.applyStylesheet(doc, None)
|
||||
style.saveResultToFilename("foo", result, 0)
|
||||
style = None
|
||||
doc.freeDoc()
|
||||
result.freeDoc()
|
||||
|
||||
# Memory debug specific
|
||||
libxslt.cleanupGlobals()
|
||||
libxml2.cleanupParser()
|
||||
if libxml2.debugMemory(1) == 0:
|
||||
print "OK"
|
||||
else:
|
||||
print "Memory leak %d bytes" % (libxml2.debugMemory(1))
|
||||
libxml2.dumpMemory()
|
@ -1,9 +0,0 @@
|
||||
#!/usr/bin/python -u
|
||||
import libxml2
|
||||
import libxslt
|
||||
|
||||
styledoc = libxml2.parseFile("test.xsl")
|
||||
style = libxslt.parseStylesheetDoc(styledoc)
|
||||
doc = libxml2.parseFile("test.xml")
|
||||
result = style.applyStylesheet(doc, None)
|
||||
result.saveFile("-")
|
Reference in New Issue
Block a user