@@ -22,7 +22,7 @@ how spaces and tabs works in XML formatting.
22
22
23
23
Here comes XML unittest TestCase: if you want to use the built-in unittest
24
24
package (or if it is a requirement), and you are not afraid of using xpath
25
- expression with lxml, this library is made for you.
25
+ expression with `` lxml `` , this library is made for you.
26
26
27
27
You will be able to test your XML document, and use the power of xpath and
28
28
various schema languages to write tests that matter.
39
39
Compatibility
40
40
=============
41
41
42
- Python ``xmlunittest `` has been tested with:
42
+ Python ``xmlunittest `` has been tested with ``lxml `` version 4.0 and 5.0
43
+ with Python 3.10.
43
44
44
- * ``lxml `` version 3.0, 3.4, 3.5 and 4.2.1
45
- * Python 2.7.12
46
- * Python 3.5.2
47
-
48
- Be aware: as a lot of string manipulation is involved, a lot of issues can
49
- happen with unicode/bytestring. It's always a bit tough when dealing with
50
- a Py2/Py3 compatible library.
51
-
52
- .. note ::
53
-
54
- Python 2.7.6 support is maintained for now, but it will be eventually
55
- dropped. It's never too late to switch to Python 3!
56
-
57
- LXML version 2.x or 3.x?
58
- ------------------------
59
-
60
- When dealing with version number, it appears that ``xmlunittest `` works with:
61
-
62
- * Python 2.7 and lxml 2.3.5 and above.
63
- * Python 3.5 and lmxl 3.0 and above.
64
-
65
- .. warning ::
66
-
67
- No, ``xmlunittest `` **does not work ** with Python 3 and an older version of
68
- lxml < 3.0. Also, note that this package is only tested with lxml >= 3.0.
69
- It works, but without warranty.
70
-
71
- Why not Python 3.3 or 3.4?
72
- --------------------------
73
-
74
- This package works with Python 2.7, but it's only because we are lucky enough.
75
- This is a small project, and it does not aim to support more than one major
76
- version of python.
77
45
78
46
How to
79
47
======
@@ -100,7 +68,7 @@ Example::
100
68
</root>"""
101
69
102
70
# Everything starts with `assertXmlDocument`
103
- root = self.assertXmlDocument(data)
71
+ root = self.assertXmlDocument(data.encode('utf-8') )
104
72
105
73
# Check namespace
106
74
self.assertXmlNamespace(root, 'ns', 'uri')
@@ -137,7 +105,7 @@ Example::
137
105
<leaf id="3" active="off" />
138
106
</root>"""
139
107
140
- self.assertXmlDocument(data)
108
+ self.assertXmlDocument(data.encode('utf-8') )
141
109
142
110
143
111
Contribute
@@ -160,7 +128,7 @@ See an example of install (without virtualenv)::
160
128
$ git clone [email protected] :YourRepo/python-xmlunittest.git xmlunittest
161
129
$ cd xmlunittest
162
130
$ pip install -r requirements.txt
163
- $ py.test test.py
131
+ $ pytest test.py
164
132
... all should be green here!
165
133
166
134
.. __ : https://github.com/Exirel/python-xmlunittest
@@ -170,36 +138,3 @@ See an example of install (without virtualenv)::
170
138
Installing lxml is not easy if you are not prepared. You will need some
171
139
extra source package on your favorite OS (in particular some XML libs and
172
140
python sources).
173
-
174
-
175
- Testing with tox
176
- ----------------
177
-
178
- Now that ``xmlunittest `` uses `tox `__ to run the tests, it's even easier to
179
- perform tests on multiple version of python. Instead of using ``py.test `` do::
180
-
181
- $ tox test
182
-
183
- And that's all! **Remember: Python 2.7 and Python 3.5. Nothing more. **
184
-
185
- .. __ : https://tox.readthedocs.org/en/latest/
186
-
187
- Tips
188
- ----
189
-
190
- **Do **:
191
-
192
- * Always test with both Python 2.7 and Python 3.5 - use Tox!
193
- * Always test with namespaces
194
- * Always provide unit-tests.
195
- * Always provide documentation.
196
- * It's better to respect PEP8.
197
-
198
- **Don't **:
199
-
200
- * Never add any other library. ``xmlunittest `` uses ``lxml `` and that's enough!
201
- * If you have to add a ``data.encode(charset) `` into an assert method, it's
202
- probably not a good idea.
203
- * XML documents can not be compared as simple strings. Don't compare them
204
- as simple string. **Don't. **
205
- * Don't write more than 80 characters per line. Please. **Don't. **
0 commit comments