Skip to content

Commit

Permalink
Remove round-trip tests of urlsplit()
Browse files Browse the repository at this point in the history
  - Don't count of tests results based on test of sys.version_info,
    because security fixes are often backported.
  • Loading branch information
brunato committed Sep 17, 2024
1 parent f4966b8 commit 059fd3b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 17 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
======================
Expand Down
2 changes: 1 addition & 1 deletion publiccode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 0 additions & 9 deletions tests/test_locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
11 changes: 5 additions & 6 deletions tests/validators/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#
# @author Davide Brunato <[email protected]>
#
import sys
import unittest
import logging
import warnings
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 059fd3b

Please sign in to comment.