[xml/sgml-pkgs] Bug#690047: Bug#690047: libxml2: Add simple autopkgtest to the package

Daniel Holbach daniel.holbach at ubuntu.com
Mon Oct 22 17:32:06 UTC 2012


Hello Aron,

On 21.10.2012 18:50, Aron Xu wrote:
> Excuse me that the mails got lost in my junk box... I'd like to ask if
> you can also add a test for its python binding? So that we can make
> sure bugs like #689191 being covered in the future. It could be a
> simple import module and perform some very basic tests.

Sure. Find a patch to be applied on top of the last one attached to this
mail.

Have a great day,
 Daniel
-------------- next part --------------
diff -Nru libxml2-2.8.0+dfsg1/debian/changelog libxml2-2.8.0+dfsg1/debian/changelog
--- libxml2-2.8.0+dfsg1/debian/changelog	2012-10-10 08:16:04.000000000 +0200
+++ libxml2-2.8.0+dfsg1/debian/changelog	2012-10-22 10:18:14.000000000 +0200
@@ -1,3 +1,10 @@
+libxml2 (2.8.0+dfsg1-5ubuntu3) raring; urgency=low
+
+  * debian/tests/control, debian/tests/python: add a small test case to 
+    exercise some basic python-libxml2 usage. 
+
+ -- Daniel Holbach <daniel.holbach at ubuntu.com>  Mon, 22 Oct 2012 10:17:40 +0200
+
 libxml2 (2.8.0+dfsg1-5ubuntu2) quantal; urgency=low
 
   * debian/tests/control: added pkg-config as depends for the test. 
diff -Nru libxml2-2.8.0+dfsg1/debian/tests/control libxml2-2.8.0+dfsg1/debian/tests/control
--- libxml2-2.8.0+dfsg1/debian/tests/control	2012-10-10 08:15:14.000000000 +0200
+++ libxml2-2.8.0+dfsg1/debian/tests/control	2012-10-22 19:29:01.000000000 +0200
@@ -1,2 +1,2 @@
-Tests: build
-Depends: libxml2-dev, build-essential, pkg-config
+Tests: build python
+Depends: libxml2-dev, python-libxml2, build-essential, pkg-config
diff -Nru libxml2-2.8.0+dfsg1/debian/tests/python libxml2-2.8.0+dfsg1/debian/tests/python
--- libxml2-2.8.0+dfsg1/debian/tests/python	1970-01-01 01:00:00.000000000 +0100
+++ libxml2-2.8.0+dfsg1/debian/tests/python	2012-10-22 10:16:11.000000000 +0200
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+python <<EOF
+import libxml2
+import sys
+
+doc = libxml2.parseDoc(
+"""<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE test [
+<!ELEMENT test (#PCDATA) >
+<!ATTLIST test xmlns:abc CDATA #FIXED "http://abc.org" >
+<!ATTLIST test abc:attr CDATA #FIXED "def" >
+]>
+<test />
+""")
+elem = doc.getRootElement()
+attr = elem.hasNsProp('attr', 'http://abc.org')
+if attr == None or attr.serialize()[:-1] != """<!ATTLIST test abc:attr CDATA #FIXED "def">""":
+    print("Failed to find defaulted attribute abc:attr")
+    sys.exit(1)
+doc.freeDoc()
+EOF


More information about the debian-xml-sgml-pkgs mailing list