From 500dc54ae4db1a8a23d26c0cb8940de16e4c636efe08c9f2a6bf140a23961292 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 10 Nov 2020 13:51:01 +0000 Subject: [PATCH] - Update to 1.3.1. - mainly accepting patches etree_import_in_tests.patch, factory_tests.patch, location_testing_script.patch, which are thus removed. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-xmlschema?expand=0&rev=24 --- etree_import_in_tests.patch | 682 ---------------------------------- factory_tests.patch | 117 ------ location_testing_script.patch | 23 -- python-xmlschema.changes | 8 + python-xmlschema.spec | 13 +- xmlschema-1.3.0.tar.gz | 3 - xmlschema-1.3.1.tar.gz | 3 + 7 files changed, 13 insertions(+), 836 deletions(-) delete mode 100644 etree_import_in_tests.patch delete mode 100644 factory_tests.patch delete mode 100644 location_testing_script.patch delete mode 100644 xmlschema-1.3.0.tar.gz create mode 100644 xmlschema-1.3.1.tar.gz diff --git a/etree_import_in_tests.patch b/etree_import_in_tests.patch deleted file mode 100644 index c8af34c..0000000 --- a/etree_import_in_tests.patch +++ /dev/null @@ -1,682 +0,0 @@ ---- a/tests/test_documents.py -+++ b/tests/test_documents.py -@@ -16,7 +16,6 @@ import io - import pathlib - import tempfile - from decimal import Decimal --from xml.etree import ElementTree - - try: - import lxml.etree as lxml_etree -@@ -27,7 +26,7 @@ from xmlschema import XMLSchema10, XMLSc - XMLResourceError, XMLSchemaValidationError, XMLSchemaDecodeError, \ - to_json, from_json - --from xmlschema.etree import is_etree_element, is_etree_document -+from xmlschema.etree import ElementTree, is_etree_element, is_etree_document - from xmlschema.namespaces import XSD_NAMESPACE, XSI_NAMESPACE - from xmlschema.resources import XMLResource - from xmlschema.documents import get_context ---- a/tests/test_etree.py -+++ b/tests/test_etree.py -@@ -11,10 +11,11 @@ - import unittest - import os - import platform --from xml.etree import ElementTree - import lxml.etree - --from xmlschema import etree -+from xmlschema.etree import ElementTree, PyElementTree, ParseError, \ -+ SafeXMLParser, etree_tostring, etree_getpath, etree_iter_location_hints, \ -+ etree_iterpath, etree_elements_assert_equal, prune_etree - - TEST_CASES_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'test_cases/') - -@@ -25,176 +26,173 @@ def casepath(relative_path): - - class TestElementTree(unittest.TestCase): - -- def test_imported_element_tree(self): -- self.assertIs(ElementTree, etree.ElementTree) -- - def test_element_string_serialization(self): -- self.assertRaises(TypeError, etree.etree_tostring, '') -+ self.assertRaises(TypeError, etree_tostring, '') - - elem = ElementTree.Element('element') -- self.assertEqual(etree.etree_tostring(elem), '') -- self.assertEqual(etree.etree_tostring(elem, xml_declaration=True), '') -+ self.assertEqual(etree_tostring(elem), '') -+ self.assertEqual(etree_tostring(elem, xml_declaration=True), '') - -- self.assertEqual(etree.etree_tostring(elem, encoding='us-ascii'), b'') -- self.assertEqual(etree.etree_tostring(elem, encoding='us-ascii', indent=' '), -+ self.assertEqual(etree_tostring(elem, encoding='us-ascii'), b'') -+ self.assertEqual(etree_tostring(elem, encoding='us-ascii', indent=' '), - b' ') -- self.assertEqual(etree.etree_tostring(elem, encoding='us-ascii', xml_declaration=True), -+ self.assertEqual(etree_tostring(elem, encoding='us-ascii', xml_declaration=True), - b'\n') - -- self.assertEqual(etree.etree_tostring(elem, encoding='ascii'), -+ self.assertEqual(etree_tostring(elem, encoding='ascii'), - b"\n") -- self.assertEqual(etree.etree_tostring(elem, encoding='ascii', xml_declaration=False), -+ self.assertEqual(etree_tostring(elem, encoding='ascii', xml_declaration=False), - b'') -- self.assertEqual(etree.etree_tostring(elem, encoding='utf-8'), b'') -- self.assertEqual(etree.etree_tostring(elem, encoding='utf-8', xml_declaration=True), -+ self.assertEqual(etree_tostring(elem, encoding='utf-8'), b'') -+ self.assertEqual(etree_tostring(elem, encoding='utf-8', xml_declaration=True), - b'\n') - -- self.assertEqual(etree.etree_tostring(elem, encoding='iso-8859-1'), -+ self.assertEqual(etree_tostring(elem, encoding='iso-8859-1'), - b"\n") -- self.assertEqual(etree.etree_tostring(elem, encoding='iso-8859-1', xml_declaration=False), -+ self.assertEqual(etree_tostring(elem, encoding='iso-8859-1', xml_declaration=False), - b"") - -- self.assertEqual(etree.etree_tostring(elem, method='html'), '') -- self.assertEqual(etree.etree_tostring(elem, method='text'), '') -+ self.assertEqual(etree_tostring(elem, method='html'), '') -+ self.assertEqual(etree_tostring(elem, method='text'), '') - -- root = etree.ElementTree.XML('\n' -- ' text1\n' -- ' text2\n' -- '') -- self.assertEqual(etree.etree_tostring(root, method='text'), '\n text1\n text2') -+ root = ElementTree.XML('\n' -+ ' text1\n' -+ ' text2\n' -+ '') -+ self.assertEqual(etree_tostring(root, method='text'), '\n text1\n text2') - - def test_py_element_string_serialization(self): -- elem = etree.PyElementTree.Element('element') -- self.assertEqual(etree.etree_tostring(elem), '') -- self.assertEqual(etree.etree_tostring(elem, xml_declaration=True), '') -+ elem = PyElementTree.Element('element') -+ self.assertEqual(etree_tostring(elem), '') -+ self.assertEqual(etree_tostring(elem, xml_declaration=True), '') - -- self.assertEqual(etree.etree_tostring(elem, encoding='us-ascii'), b'') -- self.assertEqual(etree.etree_tostring(elem, encoding='us-ascii', xml_declaration=True), -+ self.assertEqual(etree_tostring(elem, encoding='us-ascii'), b'') -+ self.assertEqual(etree_tostring(elem, encoding='us-ascii', xml_declaration=True), - b'\n') - -- self.assertEqual(etree.etree_tostring(elem, encoding='ascii'), -+ self.assertEqual(etree_tostring(elem, encoding='ascii'), - b"\n") -- self.assertEqual(etree.etree_tostring(elem, encoding='ascii', xml_declaration=False), -+ self.assertEqual(etree_tostring(elem, encoding='ascii', xml_declaration=False), - b'') -- self.assertEqual(etree.etree_tostring(elem, encoding='utf-8'), b'') -- self.assertEqual(etree.etree_tostring(elem, encoding='utf-8', xml_declaration=True), -+ self.assertEqual(etree_tostring(elem, encoding='utf-8'), b'') -+ self.assertEqual(etree_tostring(elem, encoding='utf-8', xml_declaration=True), - b'\n') - -- self.assertEqual(etree.etree_tostring(elem, encoding='iso-8859-1'), -+ self.assertEqual(etree_tostring(elem, encoding='iso-8859-1'), - b"\n") -- self.assertEqual(etree.etree_tostring(elem, encoding='iso-8859-1', xml_declaration=False), -+ self.assertEqual(etree_tostring(elem, encoding='iso-8859-1', xml_declaration=False), - b"") - -- self.assertEqual(etree.etree_tostring(elem, method='html'), '') -- self.assertEqual(etree.etree_tostring(elem, method='text'), '') -+ self.assertEqual(etree_tostring(elem, method='html'), '') -+ self.assertEqual(etree_tostring(elem, method='text'), '') - -- root = etree.PyElementTree.XML('\n' -- ' text1\n' -- ' text2\n' -- '') -- self.assertEqual(etree.etree_tostring(root, method='text'), '\n text1\n text2') -+ root = PyElementTree.XML('\n' -+ ' text1\n' -+ ' text2\n' -+ '') -+ self.assertEqual(etree_tostring(root, method='text'), '\n text1\n text2') - - def test_lxml_element_string_serialization(self): - elem = lxml.etree.Element('element') -- self.assertEqual(etree.etree_tostring(elem), '') -- self.assertEqual(etree.etree_tostring(elem, xml_declaration=True), '') -+ self.assertEqual(etree_tostring(elem), '') -+ self.assertEqual(etree_tostring(elem, xml_declaration=True), '') - -- self.assertEqual(etree.etree_tostring(elem, encoding='us-ascii'), b'') -- self.assertEqual(etree.etree_tostring(elem, encoding='us-ascii', xml_declaration=True), -+ self.assertEqual(etree_tostring(elem, encoding='us-ascii'), b'') -+ self.assertEqual(etree_tostring(elem, encoding='us-ascii', xml_declaration=True), - b'\n') - -- self.assertEqual(etree.etree_tostring(elem, encoding='ascii'), b'') -- self.assertEqual(etree.etree_tostring(elem, encoding='ascii', xml_declaration=True), -+ self.assertEqual(etree_tostring(elem, encoding='ascii'), b'') -+ self.assertEqual(etree_tostring(elem, encoding='ascii', xml_declaration=True), - b'\n') - -- self.assertEqual(etree.etree_tostring(elem, encoding='utf-8'), b'') -- self.assertEqual(etree.etree_tostring(elem, encoding='utf-8', xml_declaration=True), -+ self.assertEqual(etree_tostring(elem, encoding='utf-8'), b'') -+ self.assertEqual(etree_tostring(elem, encoding='utf-8', xml_declaration=True), - b'\n') - -- self.assertEqual(etree.etree_tostring(elem, encoding='iso-8859-1'), -+ self.assertEqual(etree_tostring(elem, encoding='iso-8859-1'), - b"\n") -- self.assertEqual(etree.etree_tostring(elem, encoding='iso-8859-1', xml_declaration=False), -+ self.assertEqual(etree_tostring(elem, encoding='iso-8859-1', xml_declaration=False), - b"") - -- self.assertEqual(etree.etree_tostring(elem, method='html'), '') -- self.assertEqual(etree.etree_tostring(elem, method='text'), '') -+ self.assertEqual(etree_tostring(elem, method='html'), '') -+ self.assertEqual(etree_tostring(elem, method='text'), '') - - root = lxml.etree.XML('\n' - ' text1\n' - ' text2\n' - '') -- self.assertEqual(etree.etree_tostring(root, method='text'), '\n text1\n text2') -+ self.assertEqual(etree_tostring(root, method='text'), '\n text1\n text2') - - def test_defuse_xml_entities(self): - xml_file = casepath('resources/with_entity.xml') - -- elem = etree.ElementTree.parse(xml_file).getroot() -+ elem = ElementTree.parse(xml_file).getroot() - self.assertEqual(elem.text, 'abc') - -- parser = etree.SafeXMLParser(target=etree.PyElementTree.TreeBuilder()) -- with self.assertRaises(etree.PyElementTree.ParseError) as ctx: -- etree.ElementTree.parse(xml_file, parser=parser) -+ parser = SafeXMLParser(target=PyElementTree.TreeBuilder()) -+ with self.assertRaises(PyElementTree.ParseError) as ctx: -+ ElementTree.parse(xml_file, parser=parser) - self.assertEqual("Entities are forbidden (entity_name='e')", str(ctx.exception)) - - def test_defuse_xml_external_entities(self): - xml_file = casepath('resources/external_entity.xml') - -- with self.assertRaises(etree.ParseError) as ctx: -- etree.ElementTree.parse(xml_file) -+ with self.assertRaises(ParseError) as ctx: -+ ElementTree.parse(xml_file) - self.assertIn("undefined entity &ee", str(ctx.exception)) - -- parser = etree.SafeXMLParser(target=etree.PyElementTree.TreeBuilder()) -- with self.assertRaises(etree.PyElementTree.ParseError) as ctx: -- etree.ElementTree.parse(xml_file, parser=parser) -+ parser = SafeXMLParser(target=PyElementTree.TreeBuilder()) -+ with self.assertRaises(PyElementTree.ParseError) as ctx: -+ ElementTree.parse(xml_file, parser=parser) - self.assertEqual("Entities are forbidden (entity_name='ee')", str(ctx.exception)) - - def test_defuse_xml_unused_external_entities(self): - xml_file = casepath('resources/unused_external_entity.xml') - -- elem = etree.ElementTree.parse(xml_file).getroot() -+ elem = ElementTree.parse(xml_file).getroot() - self.assertEqual(elem.text, 'abc') - -- parser = etree.SafeXMLParser(target=etree.PyElementTree.TreeBuilder()) -- with self.assertRaises(etree.PyElementTree.ParseError) as ctx: -- etree.ElementTree.parse(xml_file, parser=parser) -+ parser = SafeXMLParser(target=PyElementTree.TreeBuilder()) -+ with self.assertRaises(PyElementTree.ParseError) as ctx: -+ ElementTree.parse(xml_file, parser=parser) - self.assertEqual("Entities are forbidden (entity_name='ee')", str(ctx.exception)) - - def test_defuse_xml_unparsed_entities(self): - xml_file = casepath('resources/unparsed_entity.xml') - -- parser = etree.SafeXMLParser(target=etree.PyElementTree.TreeBuilder()) -- with self.assertRaises(etree.PyElementTree.ParseError) as ctx: -- etree.ElementTree.parse(xml_file, parser=parser) -+ parser = SafeXMLParser(target=PyElementTree.TreeBuilder()) -+ with self.assertRaises(PyElementTree.ParseError) as ctx: -+ ElementTree.parse(xml_file, parser=parser) - self.assertEqual("Unparsed entities are forbidden (entity_name='logo_file')", - str(ctx.exception)) - - def test_defuse_xml_unused_unparsed_entities(self): - xml_file = casepath('resources/unused_unparsed_entity.xml') - -- elem = etree.ElementTree.parse(xml_file).getroot() -+ elem = ElementTree.parse(xml_file).getroot() - self.assertIsNone(elem.text) - -- parser = etree.SafeXMLParser(target=etree.PyElementTree.TreeBuilder()) -- with self.assertRaises(etree.PyElementTree.ParseError) as ctx: -- etree.ElementTree.parse(xml_file, parser=parser) -+ parser = SafeXMLParser(target=PyElementTree.TreeBuilder()) -+ with self.assertRaises(PyElementTree.ParseError) as ctx: -+ ElementTree.parse(xml_file, parser=parser) - self.assertEqual("Unparsed entities are forbidden (entity_name='logo_file')", - str(ctx.exception)) - - def test_etree_iterpath(self): - root = ElementTree.XML('') - -- items = list(etree.etree_iterpath(root)) -+ items = list(etree_iterpath(root)) - self.assertListEqual(items, [ - (root, '.'), (root[0], './b1'), (root[0][0], './b1/c1'), - (root[0][1], './b1/c2'), (root[1], './b2'), (root[2], './b3'), - (root[2][0], './b3/c3') - ]) - -- self.assertListEqual(items, list(etree.etree_iterpath(root, tag='*'))) -- self.assertListEqual(items, list(etree.etree_iterpath(root, path=''))) -- self.assertListEqual(items, list(etree.etree_iterpath(root, path=None))) -+ self.assertListEqual(items, list(etree_iterpath(root, tag='*'))) -+ self.assertListEqual(items, list(etree_iterpath(root, path=''))) -+ self.assertListEqual(items, list(etree_iterpath(root, path=None))) - -- self.assertListEqual(list(etree.etree_iterpath(root, path='/')), [ -+ self.assertListEqual(list(etree_iterpath(root, path='/')), [ - (root, '/'), (root[0], '/b1'), (root[0][0], '/b1/c1'), - (root[0][1], '/b1/c2'), (root[1], '/b2'), (root[2], '/b3'), - (root[2][0], '/b3/c3') -@@ -203,104 +201,104 @@ class TestElementTree(unittest.TestCase) - def test_etree_getpath(self): - root = ElementTree.XML('') - -- self.assertEqual(etree.etree_getpath(root, root), '.') -- self.assertEqual(etree.etree_getpath(root[0], root), './b1') -- self.assertEqual(etree.etree_getpath(root[2][0], root), './b3/c3') -- self.assertEqual(etree.etree_getpath(root[0], root, parent_path=True), '.') -- self.assertEqual(etree.etree_getpath(root[2][0], root, parent_path=True), './b3') -- -- self.assertIsNone(etree.etree_getpath(root, root[0])) -- self.assertIsNone(etree.etree_getpath(root[0], root[1])) -- self.assertIsNone(etree.etree_getpath(root, root, parent_path=True)) -+ self.assertEqual(etree_getpath(root, root), '.') -+ self.assertEqual(etree_getpath(root[0], root), './b1') -+ self.assertEqual(etree_getpath(root[2][0], root), './b3/c3') -+ self.assertEqual(etree_getpath(root[0], root, parent_path=True), '.') -+ self.assertEqual(etree_getpath(root[2][0], root, parent_path=True), './b3') -+ -+ self.assertIsNone(etree_getpath(root, root[0])) -+ self.assertIsNone(etree_getpath(root[0], root[1])) -+ self.assertIsNone(etree_getpath(root, root, parent_path=True)) - - def test_etree_elements_assert_equal(self): - e1 = ElementTree.XML('text\n\n') - e2 = ElementTree.XML('text\n\n') - -- self.assertIsNone(etree.etree_elements_assert_equal(e1, e1)) -- self.assertIsNone(etree.etree_elements_assert_equal(e1, e2)) -+ self.assertIsNone(etree_elements_assert_equal(e1, e1)) -+ self.assertIsNone(etree_elements_assert_equal(e1, e2)) - - e2 = lxml.etree.XML('text\n\n') -- self.assertIsNone(etree.etree_elements_assert_equal(e1, e2)) -+ self.assertIsNone(etree_elements_assert_equal(e1, e2)) - - e2 = ElementTree.XML('text\n\n') - with self.assertRaises(AssertionError) as ctx: -- etree.etree_elements_assert_equal(e1, e2) -+ etree_elements_assert_equal(e1, e2) - self.assertIn("has lesser children than text \n\n') -- self.assertIsNone(etree.etree_elements_assert_equal(e1, e2, strict=False)) -+ self.assertIsNone(etree_elements_assert_equal(e1, e2, strict=False)) - with self.assertRaises(AssertionError) as ctx: -- etree.etree_elements_assert_equal(e1, e2) -+ etree_elements_assert_equal(e1, e2) - self.assertIn("texts differ: 'text' != 'text '", str(ctx.exception)) - - e2 = ElementTree.XML('text\ntext\n') - with self.assertRaises(AssertionError) as ctx: -- etree.etree_elements_assert_equal(e1, e2, strict=False) -+ etree_elements_assert_equal(e1, e2, strict=False) - self.assertIn("texts differ: None != 'text'", str(ctx.exception)) - - e2 = ElementTree.XML('text\n') -- self.assertIsNone(etree.etree_elements_assert_equal(e1, e2)) -+ self.assertIsNone(etree_elements_assert_equal(e1, e2)) - - e2 = ElementTree.XML('text\n') -- self.assertIsNone(etree.etree_elements_assert_equal(e1, e2, strict=False)) -+ self.assertIsNone(etree_elements_assert_equal(e1, e2, strict=False)) - with self.assertRaises(AssertionError) as ctx: -- etree.etree_elements_assert_equal(e1, e2) -+ etree_elements_assert_equal(e1, e2) - self.assertIn(r"tails differ: '\n' != None", str(ctx.exception)) - - e2 = ElementTree.XML('text\n\n') -- self.assertIsNone(etree.etree_elements_assert_equal(e1, e2, strict=False)) -+ self.assertIsNone(etree_elements_assert_equal(e1, e2, strict=False)) - with self.assertRaises(AssertionError) as ctx: -- etree.etree_elements_assert_equal(e1, e2) -+ etree_elements_assert_equal(e1, e2) - self.assertIn("attributes differ: {'a': '1'} != {'a': '1 '}", str(ctx.exception)) - - e2 = ElementTree.XML('text\n\n') - with self.assertRaises(AssertionError) as ctx: -- etree.etree_elements_assert_equal(e1, e2, strict=False) -+ etree_elements_assert_equal(e1, e2, strict=False) - self.assertIn("attribute 'a' values differ: '1' != '2'", str(ctx.exception)) - - e2 = ElementTree.XML('text\n\n') -- self.assertIsNone(etree.etree_elements_assert_equal(e1, e2)) -- self.assertIsNone(etree.etree_elements_assert_equal(e1, e2, skip_comments=False)) -+ self.assertIsNone(etree_elements_assert_equal(e1, e2)) -+ self.assertIsNone(etree_elements_assert_equal(e1, e2, skip_comments=False)) - - e2 = lxml.etree.XML('text\n\n') -- self.assertIsNone(etree.etree_elements_assert_equal(e1, e2)) -+ self.assertIsNone(etree_elements_assert_equal(e1, e2)) - - e1 = ElementTree.XML('+1') - e2 = ElementTree.XML('+ 1 ') -- self.assertIsNone(etree.etree_elements_assert_equal(e1, e2, strict=False)) -+ self.assertIsNone(etree_elements_assert_equal(e1, e2, strict=False)) - - e1 = ElementTree.XML('+1') - e2 = ElementTree.XML('+1.1 ') - - with self.assertRaises(AssertionError) as ctx: -- etree.etree_elements_assert_equal(e1, e2, strict=False) -+ etree_elements_assert_equal(e1, e2, strict=False) - self.assertIn("texts differ: '+1' != '+1.1 '", str(ctx.exception)) - - e1 = ElementTree.XML('1') - e2 = ElementTree.XML('true ') -- self.assertIsNone(etree.etree_elements_assert_equal(e1, e2, strict=False)) -- self.assertIsNone(etree.etree_elements_assert_equal(e2, e1, strict=False)) -+ self.assertIsNone(etree_elements_assert_equal(e1, e2, strict=False)) -+ self.assertIsNone(etree_elements_assert_equal(e2, e1, strict=False)) - - e2 = ElementTree.XML('false ') - with self.assertRaises(AssertionError) as ctx: -- etree.etree_elements_assert_equal(e1, e2, strict=False) -+ etree_elements_assert_equal(e1, e2, strict=False) - self.assertIn("texts differ: '1' != 'false '", str(ctx.exception)) - - e1 = ElementTree.XML(' 0') -- self.assertIsNone(etree.etree_elements_assert_equal(e1, e2, strict=False)) -- self.assertIsNone(etree.etree_elements_assert_equal(e2, e1, strict=False)) -+ self.assertIsNone(etree_elements_assert_equal(e1, e2, strict=False)) -+ self.assertIsNone(etree_elements_assert_equal(e2, e1, strict=False)) - - e2 = ElementTree.XML('true ') - with self.assertRaises(AssertionError) as ctx: -- etree.etree_elements_assert_equal(e1, e2, strict=False) -+ etree_elements_assert_equal(e1, e2, strict=False) - self.assertIn("texts differ: ' 0' != 'true '", str(ctx.exception)) - - e1 = ElementTree.XML('text\n\n') - e2 = ElementTree.XML('texttail\n\n') - - with self.assertRaises(AssertionError) as ctx: -- etree.etree_elements_assert_equal(e1, e2, strict=False) -+ etree_elements_assert_equal(e1, e2, strict=False) - self.assertIn("tails differ: None != 'tail'", str(ctx.exception)) - - def test_iter_location_hints(self): -@@ -309,7 +307,7 @@ class TestElementTree(unittest.TestCase) - xsi:schemaLocation="http://example.com/xmlschema/ns-A import-case4a.xsd"/>""" - ) - self.assertListEqual( -- list(etree.etree_iter_location_hints(elem)), -+ list(etree_iter_location_hints(elem)), - [('http://example.com/xmlschema/ns-A', 'import-case4a.xsd')] - ) - elem = ElementTree.XML( -@@ -317,16 +315,16 @@ class TestElementTree(unittest.TestCase) - xsi:noNamespaceSchemaLocation="schema.xsd"/>""" - ) - self.assertListEqual( -- list(etree.etree_iter_location_hints(elem)), [('', 'schema.xsd')] -+ list(etree_iter_location_hints(elem)), [('', 'schema.xsd')] - ) - - def test_prune_etree(self): - root = ElementTree.XML('') -- etree.prune_etree(root, selector=lambda x: x.tag == 'b1') -+ prune_etree(root, selector=lambda x: x.tag == 'b1') - self.assertListEqual([e.tag for e in root.iter()], ['a', 'b2', 'b3', 'c3']) - - root = ElementTree.XML('') -- etree.prune_etree(root, selector=lambda x: x.tag.startswith('c')) -+ prune_etree(root, selector=lambda x: x.tag.startswith('c')) - self.assertListEqual([e.tag for e in root.iter()], ['a', 'b1', 'b2', 'b3']) - - ---- a/tests/test_helpers.py -+++ b/tests/test_helpers.py -@@ -12,11 +12,10 @@ - import unittest - import sys - import decimal --import xml.etree.ElementTree as ElementTree - from collections import OrderedDict - - from xmlschema import XMLSchema, XMLSchemaParseError --from xmlschema.etree import etree_element, prune_etree -+from xmlschema.etree import ElementTree, etree_element, prune_etree - from xmlschema.qnames import XSD_SCHEMA, XSD_ELEMENT, XSD_SIMPLE_TYPE, XSD_ANNOTATION - from xmlschema.helpers import get_xsd_annotation, get_xsd_derivation_attribute, \ - get_xsd_form_attribute, raw_xml_encode, count_digits, strictly_equal, \ ---- a/tests/test_resources.py -+++ b/tests/test_resources.py -@@ -19,19 +19,22 @@ from urllib.error import URLError - from urllib.request import urlopen - from urllib.parse import urlsplit, uses_relative - from pathlib import Path, PureWindowsPath, PurePath --from xml.etree import ElementTree - - try: - import lxml.etree as lxml_etree - except ImportError: - lxml_etree = None - --from xmlschema import fetch_namespaces, fetch_resource, normalize_url, \ -- fetch_schema, fetch_schema_locations, XMLResource, XMLResourceError, XMLSchema --from xmlschema.etree import etree_element, py_etree_element, is_etree_element -+from xmlschema import XMLResource, XMLSchema -+from xmlschema.etree import (ElementTree, etree_element, -+ py_etree_element, is_etree_element) - from xmlschema.namespaces import XSD_NAMESPACE --from xmlschema.resources import is_url, is_local_url, is_remote_url, \ -- url_path_is_file, normalize_locations, LazySelector -+from xmlschema.exceptions import XMLResourceError -+from xmlschema.resources import (fetch_namespaces, fetch_resource, -+ fetch_schema, fetch_schema_locations, -+ is_url, is_local_url, is_remote_url, -+ url_path_is_file, normalize_locations, -+ normalize_url, LazySelector) - from xmlschema.testing import SKIP_REMOTE_TESTS - - -@@ -1076,7 +1079,7 @@ class TestResources(unittest.TestCase): - self.assertTrue(isinstance(vh_schema, XMLSchema)) - - xsd_source = """ -- - - """.format(self.vh_xsd_file) ---- a/tests/test_w3c_suite.py -+++ b/tests/test_w3c_suite.py -@@ -14,7 +14,6 @@ This script runs tests concerning the W3 - import unittest - import argparse - import os.path --import xml.etree.ElementTree as ElementTree - import warnings - - try: -@@ -23,6 +22,7 @@ except ImportError: - lxml_etree = None - - from xmlschema import validate, XMLSchema10, XMLSchema11, XMLSchemaException -+from xmlschema.etree import ElementTree - - TEST_SUITE_NAMESPACE = "http://www.w3.org/XML/2004/xml-schema-test-suite/" - XLINK_NAMESPACE = "http://www.w3.org/1999/xlink" ---- a/tests/test_wsdl.py -+++ b/tests/test_wsdl.py -@@ -14,13 +14,11 @@ import unittest - import os - - from xmlschema import XMLSchemaValidationError, XMLSchema10, XMLSchema11 --from xmlschema.etree import ParseError -+from xmlschema.etree import ElementTree, ParseError - from xmlschema.wsdl import WsdlParseError, WsdlComponent, WsdlMessage, \ - WsdlPortType, WsdlOperation, WsdlBinding, WsdlService, Wsdl11Document, \ - WsdlInput, SoapHeader - --from xml.etree import ElementTree -- - - TEST_CASES_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'test_cases/') - -@@ -97,7 +95,7 @@ WSDL_DOCUMENT_EXAMPLE = """ - - - -@@ -403,7 +401,7 @@ class TestWsdlDocuments(unittest.TestCas - - def test_wsdl_document_invalid_imports(self): - wsdl_template = """ -- - - """ -@@ -427,7 +425,7 @@ class TestWsdlDocuments(unittest.TestCas - self.assertIn('no element found', str(ctx.exception)) - - wsdl_template = """ -- - -@@ -439,7 +437,7 @@ class TestWsdlDocuments(unittest.TestCas - self.assertIn('namespace to import must be different', str(ctx.exception)) - - wsdl_template = """ -- - ---- a/tests/test_xpath.py -+++ b/tests/test_xpath.py -@@ -12,12 +12,12 @@ - - import unittest - import os --import xml.etree.ElementTree as ElementTree - from elementpath import XPath1Parser, XPath2Parser, Selector, \ - AttributeNode, TypedElement, ElementPathSyntaxError - - from xmlschema import XMLSchema10, XMLSchema11, XsdElement, XsdAttribute - from xmlschema.namespaces import XSD_NAMESPACE -+from xmlschema.etree import ElementTree - from xmlschema.xpath import XMLSchemaProxy, iter_schema_nodes - from xmlschema.validators import XsdAtomic, XsdAtomicRestriction - ---- a/tests/validation/test_decoding.py -+++ b/tests/validation/test_decoding.py -@@ -12,7 +12,6 @@ import unittest - import os - from decimal import Decimal - import base64 --from xml.etree import ElementTree - - try: - import lxml.etree as lxml_etree -@@ -24,6 +23,7 @@ import xmlschema - from xmlschema import XMLSchemaValidationError, ParkerConverter, BadgerFishConverter, \ - AbderaConverter, JsonMLConverter, ColumnarConverter - -+from xmlschema.etree import ElementTree - from xmlschema.converters import UnorderedConverter - from xmlschema.validators import XMLSchema11 - from xmlschema.testing import XsdValidatorTestCase ---- a/tests/validation/test_validation.py -+++ b/tests/validation/test_validation.py -@@ -11,7 +11,6 @@ - import unittest - import os - import sys --from xml.etree import ElementTree - - try: - import lxml.etree as lxml_etree -@@ -21,6 +20,7 @@ except ImportError: - import xmlschema - from xmlschema import XMLSchemaValidationError - -+from xmlschema.etree import ElementTree - from xmlschema.validators import XMLSchema11 - from xmlschema.testing import XsdValidatorTestCase - ---- a/tests/validators/test_exceptions.py -+++ b/tests/validators/test_exceptions.py -@@ -11,10 +11,10 @@ - import unittest - import os - import io --import xml.etree.ElementTree as ElementTree - import lxml.etree - - from xmlschema import XMLSchema, XMLResource -+from xmlschema.etree import ElementTree - from xmlschema.validators.exceptions import XMLSchemaValidatorError, \ - XMLSchemaNotBuiltError, XMLSchemaModelDepthError, XMLSchemaValidationError, \ - XMLSchemaChildrenValidationError ---- a/tests/validators/test_notations.py -+++ b/tests/validators/test_notations.py -@@ -9,9 +9,9 @@ - # @author Davide Brunato - # - import unittest --import xml.etree.ElementTree as ElementTree - - from xmlschema import XMLSchemaParseError -+from xmlschema.etree import ElementTree - from xmlschema.qnames import XSD_NOTATION - from xmlschema.validators import XMLSchema10, XMLSchema11, XsdNotation - ---- a/tests/validators/test_xsdbase.py -+++ b/tests/validators/test_xsdbase.py -@@ -12,10 +12,10 @@ import unittest - import os - import platform - import re --import xml.etree.ElementTree as ElementTree - - from xmlschema.validators import XsdValidator, XsdComponent, XMLSchema10, \ - XMLSchema11, XMLSchemaParseError, XMLSchemaValidationError, XsdGroup, XsdSimpleType -+from xmlschema.etree import ElementTree - from xmlschema.qnames import XSD_ELEMENT, XSD_ANNOTATION, XSD_ANY_TYPE - from xmlschema.namespaces import XSD_NAMESPACE - -@@ -766,7 +766,6 @@ class TestParticleMixin(unittest.TestCas - - - if __name__ == '__main__': -- import platform - header_template = "Test xmlschema's XSD base classes with Python {} on {}" - header = header_template.format(platform.python_version(), platform.platform()) - print('{0}\n{1}\n{0}'.format("*" * len(header), header)) diff --git a/factory_tests.patch b/factory_tests.patch deleted file mode 100644 index c6f42b7..0000000 --- a/factory_tests.patch +++ /dev/null @@ -1,117 +0,0 @@ ---- a/tests/test_all.py -+++ b/tests/test_all.py -@@ -13,7 +13,7 @@ if __name__ == '__main__': - import os - import platform - -- from xmlschema.testing import tests_factory, make_schema_test_class, \ -+ from xmlschema.testing import factory_tests, make_schema_test_class, \ - make_validation_test_class, get_test_program_args_parser - - DEFAULT_TESTFILES = os.path.join(os.path.dirname(__file__), 'test_cases/testfiles') -@@ -46,7 +46,7 @@ if __name__ == '__main__': - - args = get_test_program_args_parser(DEFAULT_TESTFILES).parse_args() - -- schema_tests = tests_factory( -+ schema_tests = factory_tests( - test_class_builder=make_schema_test_class, - testfiles=args.testfiles, - suffix='xsd', -@@ -54,7 +54,7 @@ if __name__ == '__main__': - ) - globals().update(schema_tests) - -- validation_tests = tests_factory( -+ validation_tests = factory_tests( - test_class_builder=make_validation_test_class, - testfiles=args.testfiles, - suffix='xml', ---- a/tests/test_schemas.py -+++ b/tests/test_schemas.py -@@ -13,7 +13,7 @@ - import os - - from xmlschema.testing import get_test_program_args_parser, \ -- tests_factory, make_schema_test_class -+ factory_tests, make_schema_test_class - - DEFAULT_TESTFILES = os.path.join(os.path.dirname(__file__), 'test_cases/testfiles') - -@@ -24,7 +24,7 @@ if __name__ == '__main__': - - args = get_test_program_args_parser(DEFAULT_TESTFILES).parse_args() - -- schema_tests = tests_factory( -+ schema_tests = factory_tests( - test_class_builder=make_schema_test_class, - testfiles=args.testfiles, - suffix='xsd', -@@ -47,7 +47,7 @@ if __name__ == '__main__': - catchbreak=args.catchbreak, buffer=args.buffer) - else: - # Creates schema tests from XSD files -- globals().update(tests_factory( -+ globals().update(factory_tests( - test_class_builder=make_schema_test_class, - suffix='xsd', - testfiles=DEFAULT_TESTFILES ---- a/tests/test_validation.py -+++ b/tests/test_validation.py -@@ -13,7 +13,7 @@ - import os - - from xmlschema.testing import get_test_program_args_parser, \ -- tests_factory, make_validation_test_class -+ factory_tests, make_validation_test_class - - DEFAULT_TESTFILES = os.path.join(os.path.dirname(__file__), 'test_cases/testfiles') - -@@ -24,7 +24,7 @@ if __name__ == '__main__': - - args = get_test_program_args_parser(DEFAULT_TESTFILES).parse_args() - -- validation_tests = tests_factory( -+ validation_tests = factory_tests( - test_class_builder=make_validation_test_class, - testfiles=args.testfiles, - suffix='xml', -@@ -47,7 +47,7 @@ if __name__ == '__main__': - catchbreak=args.catchbreak, buffer=args.buffer) - else: - # Creates schema tests from XSD files -- globals().update(tests_factory( -+ globals().update(factory_tests( - test_class_builder=make_validation_test_class, - suffix='xml', - testfiles=DEFAULT_TESTFILES ---- a/xmlschema/testing/__init__.py -+++ b/xmlschema/testing/__init__.py -@@ -23,7 +23,7 @@ from urllib.error import URLError - from .case_class import XsdValidatorTestCase - from .builders import make_schema_test_class, make_validation_test_class - from .factory import get_test_args, xsd_version_number, defuse_data, \ -- get_test_program_args_parser, get_test_line_args_parser, tests_factory -+ get_test_program_args_parser, get_test_line_args_parser, factory_tests - from .observers import SchemaObserver, ObservedXMLSchema10, ObservedXMLSchema11 - - -@@ -46,6 +46,6 @@ SKIP_REMOTE_TESTS = not has_network_acce - __all__ = [ - 'XsdValidatorTestCase', 'make_schema_test_class', 'make_validation_test_class', - 'get_test_args', 'xsd_version_number', 'defuse_data', 'get_test_program_args_parser', -- 'get_test_line_args_parser', 'tests_factory', 'SchemaObserver', 'ObservedXMLSchema10', -+ 'get_test_line_args_parser', 'factory_tests', 'SchemaObserver', 'ObservedXMLSchema10', - 'ObservedXMLSchema11', 'has_network_access', 'SKIP_REMOTE_TESTS', - ] ---- a/xmlschema/testing/factory.py -+++ b/xmlschema/testing/factory.py -@@ -117,7 +117,7 @@ def get_test_line_args_parser(): - return parser - - --def tests_factory(test_class_builder, testfiles, suffix, check_with_lxml=False): -+def factory_tests(test_class_builder, testfiles, suffix, check_with_lxml=False): - """ - Factory function for file based schema/validation cases. - diff --git a/location_testing_script.patch b/location_testing_script.patch deleted file mode 100644 index ddc2c38..0000000 --- a/location_testing_script.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- - tests/test_etree_import.py | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - ---- a/tests/test_etree_import.py -+++ b/tests/test_etree_import.py -@@ -15,7 +15,6 @@ import importlib - import subprocess - import platform - -- - def is_element_tree_imported(): - return '_elementtree' in sys.modules or 'xml.etree.ElementTree' in sys.modules - -@@ -42,7 +41,7 @@ class TestElementTreeImport(unittest.Tes - def test_element_tree_import_script(self): - test_dir = os.path.dirname(__file__) or '.' - -- cmd = [os.path.join(test_dir, 'check_etree_import.py')] -+ cmd = [sys.executable, os.path.join(test_dir, 'check_etree_import.py')] - process = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - - stderr = process.stderr.decode('utf-8') diff --git a/python-xmlschema.changes b/python-xmlschema.changes index 66ba4b3..3b1d7ef 100644 --- a/python-xmlschema.changes +++ b/python-xmlschema.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Nov 10 13:49:08 UTC 2020 - Matej Cepl + +- Update to 1.3.1. + - mainly accepting patches etree_import_in_tests.patch, + factory_tests.patch, location_testing_script.patch, which are thus + removed. + ------------------------------------------------------------------- Tue Nov 10 07:13:53 UTC 2020 - Matej Cepl diff --git a/python-xmlschema.spec b/python-xmlschema.spec index 6e26ac6..136e214 100644 --- a/python-xmlschema.spec +++ b/python-xmlschema.spec @@ -19,24 +19,15 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-xmlschema -Version: 1.3.0 +Version: 1.3.1 Release: 0 Summary: An XML Schema validator and decoder License: MIT URL: https://github.com/sissaschool/xmlschema Source: https://files.pythonhosted.org/packages/source/x/xmlschema/xmlschema-%{version}.tar.gz -# PATCH-FIX-UPSTREAM etree_import_in_tests.patch gh#sissaschool/xmlschema#210 mcepl@suse.com -# use the same etree all the time -Patch0: etree_import_in_tests.patch -# PATCH-FIX-UPSTREAM factory_tests.patch gh#sissaschool/xmlschema#210 mcepl@suse.com -# rename tests_factory to factory_tests so it is not discovered by pytest. -Patch1: factory_tests.patch # PATCH-FIX-UPSTREAM remove_shebang.patch gh#sissaschool/xmlschema#210 mcepl@suse.com # Remove superfluous shebang -Patch2: remove_shebang.patch -# PATCH-FIX-UPSTREAM location_testing_script.patch gh#sissaschool/xmlschema#210 mcepl@suse.com -# this patch makes things totally awesome -Patch3: location_testing_script.patch +Patch0: remove_shebang.patch BuildRequires: %{python_module elementpath >= 1.4.0} BuildRequires: %{python_module lxml} BuildRequires: %{python_module pip} diff --git a/xmlschema-1.3.0.tar.gz b/xmlschema-1.3.0.tar.gz deleted file mode 100644 index d578b85..0000000 --- a/xmlschema-1.3.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:638eddd3150b8214397eddeb9402457678b63a343c468a96042f56438b6ff1d8 -size 319713 diff --git a/xmlschema-1.3.1.tar.gz b/xmlschema-1.3.1.tar.gz new file mode 100644 index 0000000..028b398 --- /dev/null +++ b/xmlschema-1.3.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef25efd054afe5bbbbe0c5f86f32bd8e8afd566c90986d6b80a2abb8e6a4c46e +size 318853