diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am index c2270ce5..5cfcac45 100644 --- a/python/tests/Makefile.am +++ b/python/tests/Makefile.am @@ -62,8 +62,7 @@ if WITH_PYTHON check-local: @for f in $(XMLS) ; do test -f $$f || $(LN_S) $(srcdir)/$$f . ; done @echo "## running Python regression tests" - @(export PYTHONPATH="..:../.libs:$(srcdir)/..:$$PYTHONPATH" ; \ - export LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \ + @(export LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \ export DYLD_LIBRARY_PATH="$(top_builddir)/.libs:$$DYLD_LIBRARY_PATH" ; \ export PATH="$(top_builddir)/.libs:$$PATH" ; \ for test in $(PYTESTS) ; do \ diff --git a/python/tests/attribs.py b/python/tests/attribs.py index 16d22f1f..5627a37d 100755 --- a/python/tests/attribs.py +++ b/python/tests/attribs.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import sys +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/build.py b/python/tests/build.py index fa894570..f786b0cf 100755 --- a/python/tests/build.py +++ b/python/tests/build.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +import setup_test import libxml2 import sys diff --git a/python/tests/compareNodes.py b/python/tests/compareNodes.py index 9bf6482b..46779b82 100755 --- a/python/tests/compareNodes.py +++ b/python/tests/compareNodes.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import sys +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/ctxterror.py b/python/tests/ctxterror.py index 4646c2df..7deaebbf 100755 --- a/python/tests/ctxterror.py +++ b/python/tests/ctxterror.py @@ -4,6 +4,7 @@ # functions defined in Python. # import sys +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/cutnpaste.py b/python/tests/cutnpaste.py index 53eafc45..4df0902b 100755 --- a/python/tests/cutnpaste.py +++ b/python/tests/cutnpaste.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import sys +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/dtdvalid.py b/python/tests/dtdvalid.py index 8f461af4..5bd4ef8e 100755 --- a/python/tests/dtdvalid.py +++ b/python/tests/dtdvalid.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +import setup_test import libxml2 import sys diff --git a/python/tests/error.py b/python/tests/error.py index 932751ff..603eb518 100755 --- a/python/tests/error.py +++ b/python/tests/error.py @@ -4,6 +4,7 @@ # functions defined in Python. # import sys +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/inbuf.py b/python/tests/inbuf.py index d1225cf3..a80ae7d1 100755 --- a/python/tests/inbuf.py +++ b/python/tests/inbuf.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import sys +import setup_test import libxml2 try: import StringIO diff --git a/python/tests/indexes.py b/python/tests/indexes.py index 14b5f11d..46737659 100755 --- a/python/tests/indexes.py +++ b/python/tests/indexes.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 # -*- coding: ISO-8859-1 -*- import sys +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/input_callback.py b/python/tests/input_callback.py index 9151e762..ad8cf3ba 100755 --- a/python/tests/input_callback.py +++ b/python/tests/input_callback.py @@ -3,6 +3,7 @@ # This tests custom input callbacks # import sys +import setup_test import libxml2 try: import StringIO diff --git a/python/tests/nsdel.py b/python/tests/nsdel.py index 435da61b..8e1b291b 100755 --- a/python/tests/nsdel.py +++ b/python/tests/nsdel.py @@ -4,6 +4,7 @@ # allows to detect memory leaks # import sys +import setup_test import libxml2 instance=""" diff --git a/python/tests/outbuf.py b/python/tests/outbuf.py index cdd93518..64335658 100755 --- a/python/tests/outbuf.py +++ b/python/tests/outbuf.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import sys +import setup_test import libxml2 try: import StringIO diff --git a/python/tests/push.py b/python/tests/push.py index 2c69d729..10781784 100755 --- a/python/tests/push.py +++ b/python/tests/push.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import sys +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/pushSAX.py b/python/tests/pushSAX.py index ebe62c98..f30088d4 100755 --- a/python/tests/pushSAX.py +++ b/python/tests/pushSAX.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import sys +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/pushSAXhtml.py b/python/tests/pushSAXhtml.py index c4126544..c32cd3e7 100755 --- a/python/tests/pushSAXhtml.py +++ b/python/tests/pushSAXhtml.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import sys +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/reader.py b/python/tests/reader.py index 870abf20..318eb5e0 100755 --- a/python/tests/reader.py +++ b/python/tests/reader.py @@ -3,6 +3,7 @@ # # this tests the basic APIs of the XmlTextReader interface # +import setup_test import libxml2 import sys try: diff --git a/python/tests/reader2.py b/python/tests/reader2.py index 66b5c2d0..9f14ecd2 100755 --- a/python/tests/reader2.py +++ b/python/tests/reader2.py @@ -6,6 +6,7 @@ import sys import glob import os +import setup_test import libxml2 try: import StringIO diff --git a/python/tests/reader3.py b/python/tests/reader3.py index d3241029..9a545407 100755 --- a/python/tests/reader3.py +++ b/python/tests/reader3.py @@ -3,6 +3,7 @@ # this tests the entities substitutions with the XmlTextReader interface # import sys +import setup_test import libxml2 try: import StringIO diff --git a/python/tests/reader4.py b/python/tests/reader4.py index aea4bf4d..677d089f 100755 --- a/python/tests/reader4.py +++ b/python/tests/reader4.py @@ -2,6 +2,7 @@ # # this tests the basic APIs of the XmlTextReader interface # +import setup_test import libxml2 import sys try: diff --git a/python/tests/reader5.py b/python/tests/reader5.py index 6f382519..201a53b5 100755 --- a/python/tests/reader5.py +++ b/python/tests/reader5.py @@ -3,6 +3,7 @@ # this tests the Expand() API of the xmlTextReader interface # this extract the Dragon bibliography entries from the XML specification # +import setup_test import libxml2 import os import sys diff --git a/python/tests/reader6.py b/python/tests/reader6.py index 75a6f799..33a55974 100755 --- a/python/tests/reader6.py +++ b/python/tests/reader6.py @@ -3,6 +3,7 @@ # this tests the entities substitutions with the XmlTextReader interface # import sys +import setup_test import libxml2 try: import StringIO diff --git a/python/tests/reader7.py b/python/tests/reader7.py index f1735caa..58131a8c 100755 --- a/python/tests/reader7.py +++ b/python/tests/reader7.py @@ -3,6 +3,7 @@ # this tests the entities substitutions with the XmlTextReader interface # import sys +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/reader8.py b/python/tests/reader8.py index 6e0a70ad..bc055dfd 100755 --- a/python/tests/reader8.py +++ b/python/tests/reader8.py @@ -3,6 +3,7 @@ # this tests the entities substitutions with the XmlTextReader interface # import sys +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/readererr.py b/python/tests/readererr.py index 9c518215..e3fdba6d 100755 --- a/python/tests/readererr.py +++ b/python/tests/readererr.py @@ -2,6 +2,7 @@ # # this tests the basic APIs of the XmlTextReader interface # +import setup_test import libxml2 import sys try: diff --git a/python/tests/readernext.py b/python/tests/readernext.py index cf5f0156..4f216bb4 100755 --- a/python/tests/readernext.py +++ b/python/tests/readernext.py @@ -3,6 +3,7 @@ # # this tests the next API of the XmlTextReader interface # +import setup_test import libxml2 import sys try: diff --git a/python/tests/regexp.py b/python/tests/regexp.py index 74b4c919..890d1dc8 100755 --- a/python/tests/regexp.py +++ b/python/tests/regexp.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/relaxng.py b/python/tests/relaxng.py index 63b77e09..518b97e6 100755 --- a/python/tests/relaxng.py +++ b/python/tests/relaxng.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +import setup_test import libxml2 import sys diff --git a/python/tests/resolver.py b/python/tests/resolver.py index cb66c6f0..da8fc148 100755 --- a/python/tests/resolver.py +++ b/python/tests/resolver.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import sys +import setup_test import libxml2 try: import StringIO diff --git a/python/tests/schema.py b/python/tests/schema.py index de5cd456..c73b81aa 100755 --- a/python/tests/schema.py +++ b/python/tests/schema.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +import setup_test import libxml2 import sys diff --git a/python/tests/serialize.py b/python/tests/serialize.py index 7fea7aaa..4666ec46 100755 --- a/python/tests/serialize.py +++ b/python/tests/serialize.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import sys +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/setup_test.py b/python/tests/setup_test.py new file mode 100644 index 00000000..84f07b18 --- /dev/null +++ b/python/tests/setup_test.py @@ -0,0 +1,7 @@ +import os +import sys + +sys.path += ('..', '../.libs') + +if hasattr(os, 'add_dll_directory'): + os.add_dll_directory(os.path.join(os.getcwd(), '..', '..', '.libs')) diff --git a/python/tests/sync.py b/python/tests/sync.py index 29b4a653..ffbe5400 100755 --- a/python/tests/sync.py +++ b/python/tests/sync.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import sys +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/thread2.py b/python/tests/thread2.py index 4722592c..3de62480 100755 --- a/python/tests/thread2.py +++ b/python/tests/thread2.py @@ -6,6 +6,7 @@ except: from thread import get_ident from threading import Thread, Lock +import setup_test import libxml2 THREADS_COUNT = 15 diff --git a/python/tests/tst.py b/python/tests/tst.py index 6887cac3..ba624b31 100755 --- a/python/tests/tst.py +++ b/python/tests/tst.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import sys +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/tstLastError.py b/python/tests/tstLastError.py index 45c99f00..902a7cb8 100755 --- a/python/tests/tstLastError.py +++ b/python/tests/tstLastError.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import sys, unittest +import setup_test import libxml2 class TestCase(unittest.TestCase): diff --git a/python/tests/tstURI.py b/python/tests/tstURI.py index 04543d7d..0b1bcbc9 100755 --- a/python/tests/tstURI.py +++ b/python/tests/tstURI.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import sys +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/tstmem.py b/python/tests/tstmem.py index 70477275..eca07549 100755 --- a/python/tests/tstmem.py +++ b/python/tests/tstmem.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +import setup_test import libxml2 try: diff --git a/python/tests/tstxpath.py b/python/tests/tstxpath.py index 45b2833e..d429f54c 100755 --- a/python/tests/tstxpath.py +++ b/python/tests/tstxpath.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import sys +import setup_test import libxml2 #memory debug specific diff --git a/python/tests/validDTD.py b/python/tests/validDTD.py index 5d1c9c81..b1183266 100755 --- a/python/tests/validDTD.py +++ b/python/tests/validDTD.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +import setup_test import libxml2 import sys diff --git a/python/tests/validRNG.py b/python/tests/validRNG.py index 72978688..bcc729f3 100755 --- a/python/tests/validRNG.py +++ b/python/tests/validRNG.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +import setup_test import libxml2 import sys diff --git a/python/tests/validSchemas.py b/python/tests/validSchemas.py index f5929100..9e642105 100755 --- a/python/tests/validSchemas.py +++ b/python/tests/validSchemas.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +import setup_test import libxml2 import sys diff --git a/python/tests/validate.py b/python/tests/validate.py index 830b5da3..dbf5966b 100755 --- a/python/tests/validate.py +++ b/python/tests/validate.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import sys +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/walker.py b/python/tests/walker.py index 99d89135..b1af875f 100755 --- a/python/tests/walker.py +++ b/python/tests/walker.py @@ -3,6 +3,7 @@ # this tests the entities substitutions with the XmlTextReader interface # import sys +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/xpath.py b/python/tests/xpath.py index 9736bde7..ae144860 100755 --- a/python/tests/xpath.py +++ b/python/tests/xpath.py @@ -4,6 +4,7 @@ # allows to detect memory leaks # import sys +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/xpathext.py b/python/tests/xpathext.py index 2506287e..4eb83134 100755 --- a/python/tests/xpathext.py +++ b/python/tests/xpathext.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import sys +import setup_test import libxml2 # Memory debug specific diff --git a/python/tests/xpathleak.py b/python/tests/xpathleak.py index 6814baeb..87345617 100755 --- a/python/tests/xpathleak.py +++ b/python/tests/xpathleak.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 -import sys, libxml2 +import setup_test +import libxml2 +import sys libxml2.debugMemory(True) diff --git a/python/tests/xpathns.py b/python/tests/xpathns.py index 7fe4235d..4567fcf6 100755 --- a/python/tests/xpathns.py +++ b/python/tests/xpathns.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 # +import setup_test import libxml2 expect=' xmlns:a="urn:whatevar"' diff --git a/python/tests/xpathret.py b/python/tests/xpathret.py index 219c2ed3..76d5cb77 100755 --- a/python/tests/xpathret.py +++ b/python/tests/xpathret.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import sys +import setup_test import libxml2 #memory debug specific