Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Library using lxml and unittest for unit testing XML. This is an actively maintained and PEP8 compliant fork of xmlunittest.

Project Description
Python XML-Unittest
[![Build Status](](

This is a spork of [](
With wider lxml support and Python 2.7, 3.4 & 3.4 support.


- Extend xmlunittest.XmlTestCase
- Write your tests, using the function or method that generate XML document
- Use xmlunittest.XmlTestCase‘s assertion methods to validate
- Keep your test readable



from xmlunittest import XmlTestCase

class CustomTestCase(XmlTestCase):

def test_my_custom_test(self):
# In a real case, data come from a call to your function/method.
data = """<?xml version="1.0" encoding="UTF-8" ?>
<root xmlns:ns="uri">
<leaf id="1" active="on" />
<leaf id="2" active="on" />
<leaf id="3" active="off" />

# Everything starts with `assert_xml_document`
root = self.assert_xml_document(data)

# Check namespace
self.assert_xml_namespace(root, 'ns', 'uri')
# Check
self.assert_xpaths_unique_value(root, ('./leaf@id', ))
self.assert_xpath_values(root, './leaf@active', ('on', 'off'))

Running the tests

To run the unit tests for this package::

pip install tox
Release History

Release History

This version
History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
xmlunittestbetter-0.1.tar.gz (4.9 kB) Copy SHA256 Checksum SHA256 Source Jan 21, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting