forked from pool/python-xmlschema
- Add patches
- factory_tests.patch rename tests_factory to tests so it is not recognized by pytest - remove_shebang.patch just cleaning superfluous shebang - location_testing_script.patch use actual Python executable OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-xmlschema?expand=0&rev=21
This commit is contained in:
117
factory_tests.patch
Normal file
117
factory_tests.patch
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
--- 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.
|
||||||
|
|
23
location_testing_script.patch
Normal file
23
location_testing_script.patch
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
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')
|
@@ -7,6 +7,11 @@ Mon Nov 9 15:32:59 UTC 2020 - Matej Cepl <mcepl@suse.com>
|
|||||||
- Refactoring of XMLResource to support ElementTree-like XPath
|
- Refactoring of XMLResource to support ElementTree-like XPath
|
||||||
API on both full and lazy modes
|
API on both full and lazy modes
|
||||||
- Remove skip_network_tests.patch
|
- Remove skip_network_tests.patch
|
||||||
|
- Add patches
|
||||||
|
- factory_tests.patch rename tests_factory to tests so it is
|
||||||
|
not recognized by pytest
|
||||||
|
- remove_shebang.patch just cleaning superfluous shebang
|
||||||
|
- location_testing_script.patch use actual Python executable
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sun Oct 11 16:18:52 UTC 2020 - Matej Cepl <mcepl@suse.com>
|
Sun Oct 11 16:18:52 UTC 2020 - Matej Cepl <mcepl@suse.com>
|
||||||
|
@@ -25,6 +25,15 @@ Summary: An XML Schema validator and decoder
|
|||||||
License: MIT
|
License: MIT
|
||||||
URL: https://github.com/sissaschool/xmlschema
|
URL: https://github.com/sissaschool/xmlschema
|
||||||
Source: https://files.pythonhosted.org/packages/source/x/xmlschema/xmlschema-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/x/xmlschema/xmlschema-%{version}.tar.gz
|
||||||
|
# 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.
|
||||||
|
Patch0: factory_tests.patch
|
||||||
|
# PATCH-FIX-UPSTREAM remove_shebang.patch gh#sissaschool/xmlschema#210 mcepl@suse.com
|
||||||
|
# Remove superfluous shebang
|
||||||
|
Patch1: remove_shebang.patch
|
||||||
|
# PATCH-FIX-UPSTREAM location_testing_script.patch gh#sissaschool/xmlschema#210 mcepl@suse.com
|
||||||
|
# this patch makes things totally awesome
|
||||||
|
Patch2: location_testing_script.patch
|
||||||
BuildRequires: %{python_module elementpath >= 1.4.0}
|
BuildRequires: %{python_module elementpath >= 1.4.0}
|
||||||
BuildRequires: %{python_module lxml}
|
BuildRequires: %{python_module lxml}
|
||||||
BuildRequires: %{python_module pip}
|
BuildRequires: %{python_module pip}
|
||||||
@@ -52,8 +61,6 @@ sed -i -e 's:~=:>=:' setup.py
|
|||||||
rm tests/check_memory.py
|
rm tests/check_memory.py
|
||||||
rm tests/test_memory.py
|
rm tests/test_memory.py
|
||||||
|
|
||||||
sed -i -e '1s@/usr/bin/env python@/usr/bin/python@' xmlschema/testing/builders.py
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
export LANG="en_US.UTF8"
|
export LANG="en_US.UTF8"
|
||||||
%python_build
|
%python_build
|
||||||
@@ -71,11 +78,11 @@ done
|
|||||||
export LANG="en_US.UTF8"
|
export LANG="en_US.UTF8"
|
||||||
# test_element_tree_import_script is (easily workaroundable) gh#sissaschool/xmlschema#167
|
# test_element_tree_import_script is (easily workaroundable) gh#sissaschool/xmlschema#167
|
||||||
# tests_factory setup is broken
|
# tests_factory setup is broken
|
||||||
SKIP_TESTS="test_element_tree_import_script or tests_factory"
|
# SKIP_TESTS="test_element_tree_import_script"
|
||||||
# gh#sissaschool/xmlschema#210
|
# gh#sissaschool/xmlschema#210
|
||||||
SKIP_TESTS="$SKIP_TESTS or test_imported_element_tree or test_xml_resource_defuse"
|
SKIP_TESTS="test_imported_element_tree or test_xml_resource_defuse"
|
||||||
SKIP_TESTS="$SKIP_TESTS or test_xml_resource_from_string"
|
SKIP_TESTS="$SKIP_TESTS or test_xml_resource_from_string"
|
||||||
%pytest -k "not ($SKIP_TESTS)" tests
|
%pytest -s -k "not ($SKIP_TESTS)" tests
|
||||||
|
|
||||||
%post
|
%post
|
||||||
%python_install_alternative xmlschema-json2xml
|
%python_install_alternative xmlschema-json2xml
|
||||||
|
8
remove_shebang.patch
Normal file
8
remove_shebang.patch
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
--- a/xmlschema/testing/builders.py
|
||||||
|
+++ b/xmlschema/testing/builders.py
|
||||||
|
@@ -1,5 +1,3 @@
|
||||||
|
-#!/usr/bin/env python
|
||||||
|
-#
|
||||||
|
# Copyright (c), 2016-2020, SISSA (International School for Advanced Studies).
|
||||||
|
# All rights reserved.
|
||||||
|
# This file is distributed under the terms of the MIT License.
|
Reference in New Issue
Block a user