From 059fd3bfb305809d5ebdede1bd68dff9dbaf3348 Mon Sep 17 00:00:00 2001 From: Davide Brunato Date: Tue, 17 Sep 2024 18:49:51 +0200 Subject: [PATCH] Remove round-trip tests of urlsplit() - Don't count of tests results based on test of sys.version_info, because security fixes are often backported. --- CHANGELOG.rst | 3 ++- publiccode.yml | 2 +- tests/test_locations.py | 9 --------- tests/validators/test_schemas.py | 11 +++++------ 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a40a2751..ee44137f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,9 +2,10 @@ CHANGELOG ********* -`v3.4.2`_ (2024-09-12) +`v3.4.2`_ (2024-09-17) ====================== * Fix other failing URL normalization tests +* Avoid the use of sys.version_info for checking results, better to extend the check to more values. `v3.4.1`_ (2024-09-12) ====================== diff --git a/publiccode.yml b/publiccode.yml index cc0fb03b..a4e43dfd 100644 --- a/publiccode.yml +++ b/publiccode.yml @@ -6,7 +6,7 @@ publiccodeYmlVersion: '0.2' name: xmlschema url: 'https://github.com/sissaschool/xmlschema' landingURL: 'https://github.com/sissaschool/xmlschema' -releaseDate: '2024-09-12' +releaseDate: '2024-09-17' softwareVersion: v3.4.2 developmentStatus: stable platforms: diff --git a/tests/test_locations.py b/tests/test_locations.py index 1e6b0b76..ab9cfc34 100644 --- a/tests/test_locations.py +++ b/tests/test_locations.py @@ -206,15 +206,6 @@ def test_get_uri(self): url = 'D:/a/xmlschema/xmlschema/tests/test_cases/examples/' self.assertNotEqual(get_uri(*urlsplit(url)), url) - # Test urlsplit() roundtrip with urlunsplit() - for url in URL_CASES: - if url == 'file:other.xsd': - pass # Nonstandard: https://datatracker.ietf.org/doc/html/rfc8089#appendix-E.2.1 - elif url.startswith(('////', 'file:////')) and not is_unc_path('////'): - self.assertNotEqual(urlsplit(url).geturl(), url) - else: - self.assertEqual(urlsplit(url).geturl(), url) - def test_get_uri_path(self): self.assertEqual(get_uri_path('https', 'host', 'path', 'id=7', 'types'), '//host/path') diff --git a/tests/validators/test_schemas.py b/tests/validators/test_schemas.py index e683a61d..f68a813d 100644 --- a/tests/validators/test_schemas.py +++ b/tests/validators/test_schemas.py @@ -8,7 +8,6 @@ # # @author Davide Brunato # -import sys import unittest import logging import warnings @@ -701,13 +700,13 @@ class CustomLocalXMLSchema(self.schema_class): schema = CustomLocalXMLSchema(str(schema_file)) self.assertTrue(schema.is_valid(str(xml_file))) - with self.assertRaises((pickle.PicklingError, AttributeError)) as ec: + with self.assertRaises((pickle.PicklingError, AttributeError)) as ec: # type: ignore pickle.dumps(schema) - if sys.version_info[:3] <= (3, 12, 4): - self.assertIn("Can't pickle", str(ec.exception)) - else: - self.assertIn("Can't get local object", str(ec.exception)) + error_message = str(ec.exception) + self.assertTrue( + "Can't get local object" in error_message or "Can't pickle" in error_message + ) def test_meta_schema_validation(self): self.assertTrue(self.schema_class.meta_schema.is_valid(self.vh_xsd_file))