diff options
Diffstat (limited to 'python/tests/thread2.py')
-rwxr-xr-x | python/tests/thread2.py | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/python/tests/thread2.py b/python/tests/thread2.py index 2749eb0..c8ac5ed 100755 --- a/python/tests/thread2.py +++ b/python/tests/thread2.py @@ -1,9 +1,6 @@ #!/usr/bin/python -u import string, sys, time -try: - from _thread import get_ident -except: - from thread import get_ident +import thread from threading import Thread, Lock import libxml2 @@ -34,8 +31,8 @@ def test(expectedLineNumbersDefault): # check a per thread-global if expectedLineNumbersDefault != getLineNumbersDefault(): failed = 1 - print("FAILED to obtain correct value for " \ - "lineNumbersDefault in thread %d" % get_ident()) + print "FAILED to obtain correct value for " \ + "lineNumbersDefault in thread %d" % thread.get_ident() # check ther global error handler # (which is NOT per-thread in the python bindings) try: @@ -54,7 +51,7 @@ libxml2.lineNumbersDefault(1) test(1) ec = len(eh.errors) if ec == 0: - print("FAILED: should have obtained errors") + print "FAILED: should have obtained errors" sys.exit(1) ts = [] @@ -68,7 +65,7 @@ for t in ts: t.join() if len(eh.errors) != ec+THREADS_COUNT*ec: - print("FAILED: did not obtain the correct number of errors") + print "FAILED: did not obtain the correct number of errors" sys.exit(1) # set lineNumbersDefault for future new threads @@ -83,17 +80,17 @@ for t in ts: t.join() if len(eh.errors) != ec+THREADS_COUNT*ec*2: - print("FAILED: did not obtain the correct number of errors") + print "FAILED: did not obtain the correct number of errors" sys.exit(1) if failed: - print("FAILED") + print "FAILED" sys.exit(1) # Memory debug specific libxml2.cleanupParser() if libxml2.debugMemory(1) == 0: - print("OK") + print "OK" else: - print("Memory leak %d bytes" % (libxml2.debugMemory(1))) + print "Memory leak %d bytes" % (libxml2.debugMemory(1)) libxml2.dumpMemory() |