Mercurial > p > roundup > code
comparison test/test_xmlrpc.py @ 8238:05405220dc38
issue2551116 - difusedxml support - python2 fixups.
Make sure python2 code path sets client.defusedxml so the code can
still run.
Bomb tests fail under python2. So disable test under python 2. In the
past it was due to string/byte type difference. Not worth fixing the
tests since python 2 support dropped.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 29 Dec 2024 19:48:42 -0500 |
| parents | 57325fea9982 |
| children | 31f86326bee8 |
comparison
equal
deleted
inserted
replaced
| 8237:57325fea9982 | 8238:05405220dc38 |
|---|---|
| 32 else: | 32 else: |
| 33 skip_defusedxml = mark_class(pytest.mark.skip( | 33 skip_defusedxml = mark_class(pytest.mark.skip( |
| 34 reason='Skipping defusedxml tests: defusedxml library not available')) | 34 reason='Skipping defusedxml tests: defusedxml library not available')) |
| 35 | 35 |
| 36 skip_defusedxml_used = lambda func, *args, **kwargs: func | 36 skip_defusedxml_used = lambda func, *args, **kwargs: func |
| 37 | |
| 38 if sys.version_info[0] > 2: | |
| 39 skip_python2 = lambda func, *args, **kwargs: func | |
| 40 else: | |
| 41 skip_python2 = mark_class(pytest.mark.skip( | |
| 42 reason='Skipping test under python 2')) | |
| 43 | |
| 37 | 44 |
| 38 class XmlrpcTest(object): | 45 class XmlrpcTest(object): |
| 39 | 46 |
| 40 backend = None | 47 backend = None |
| 41 | 48 |
| 325 'keyword': [], 'title': 'i2', 'nosy': [], 'messages': [], | 332 'keyword': [], 'title': 'i2', 'nosy': [], 'messages': [], |
| 326 'priority': None, 'assignedto': None, 'superseder': []}] | 333 'priority': None, 'assignedto': None, 'superseder': []}] |
| 327 for n, r in enumerate(result): | 334 for n, r in enumerate(result): |
| 328 self.assertEqual(r, results[n]) | 335 self.assertEqual(r, results[n]) |
| 329 | 336 |
| 337 @skip_python2 | |
| 330 @skip_defusedxml | 338 @skip_defusedxml |
| 331 def testDefusedXmlBomb(self): | 339 def testDefusedXmlBomb(self): |
| 332 self.XmlBomb(expectIn=b"defusedxml.common.EntitiesForbidden") | 340 self.XmlBomb(expectIn=b"defusedxml.common.EntitiesForbidden") |
| 333 | 341 |
| 342 @skip_python2 | |
| 334 @skip_defusedxml_used | 343 @skip_defusedxml_used |
| 335 def testNonDefusedXmlBomb(self): | 344 def testNonDefusedXmlBomb(self): |
| 336 self.XmlBomb(expectIn=b"1234567890"*511) | 345 self.XmlBomb(expectIn=b"1234567890"*511) |
| 337 | 346 |
| 338 def XmlBomb(self, expectIn=None): | 347 def XmlBomb(self, expectIn=None): |
