diff --git a/.github/workflows/test-xmlschema.yml b/.github/workflows/test-xmlschema.yml index 8b6e034f..b1c11fe1 100644 --- a/.github/workflows/test-xmlschema.yml +++ b/.github/workflows/test-xmlschema.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [3.8, 3.9, "3.10", 3.11, 3.12, "3.13.0-alpha.6", "pypy-3.10"] + python-version: [3.8, 3.9, "3.10", 3.11, 3.12, "3.13.0-beta.3", "pypy-3.10"] exclude: - os: macos-latest python-version: 3.8 @@ -36,7 +36,7 @@ jobs: python -m pip install --upgrade pip pip install setuptools - name: Install optional dependencies - if: ${{ matrix.python-version != '3.13.0-alpha.6' }} + if: ${{ matrix.python-version != '3.13.0-beta.3' }} run: pip install lxml jinja2 - name: Test with unittest run: | @@ -48,5 +48,5 @@ jobs: flake8 xmlschema --max-line-length=100 --statistics - name: Lint with mypy run: | - pip install mypy==1.10.0 elementpath==4.4.0 lxml-stubs + pip install mypy==1.11.0 elementpath==4.4.0 lxml-stubs mypy --show-error-codes --strict xmlschema diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8926a06b..a2e818c7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,10 @@ CHANGELOG ********* +`v3.3.2`_ (2024-07-29) +====================== +* Fix UNC path tests (issues #405 and #408) + `v3.3.1`_ (2024-04-27) ====================== * Update validation errors with logging stacktrace in debug mode @@ -704,3 +708,4 @@ v0.9.6 (2017-05-05) .. _v3.2.1: https://github.com/brunato/xmlschema/compare/v3.2.0...v3.2.1 .. _v3.3.0: https://github.com/brunato/xmlschema/compare/v3.2.1...v3.3.0 .. _v3.3.1: https://github.com/brunato/xmlschema/compare/v3.3.0...v3.3.1 +.. _v3.3.2: https://github.com/brunato/xmlschema/compare/v3.3.1...v3.3.2 diff --git a/doc/conf.py b/doc/conf.py index 804d0209..a3441fc7 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -81,7 +81,7 @@ # The short X.Y version. version = '3.3' # The full version, including alpha/beta/rc tags. -release = '3.3.1' +release = '3.3.2' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/publiccode.yml b/publiccode.yml index b72aac70..804bfc52 100644 --- a/publiccode.yml +++ b/publiccode.yml @@ -6,8 +6,8 @@ publiccodeYmlVersion: '0.2' name: xmlschema url: 'https://github.com/sissaschool/xmlschema' landingURL: 'https://github.com/sissaschool/xmlschema' -releaseDate: '2024-04-27' -softwareVersion: v3.3.1 +releaseDate: '2024-07-29' +softwareVersion: v3.3.2 developmentStatus: stable platforms: - linux diff --git a/setup.py b/setup.py index a136b312..41c99c7d 100755 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ setup( name='xmlschema', - version='3.3.1', + version='3.3.2', packages=find_packages(include=['xmlschema*']), package_data={ 'xmlschema': ['py.typed', 'locale/**/*.mo', 'locale/**/*.po', 'schemas/*/*.xsd'], diff --git a/tests/test_locations.py b/tests/test_locations.py index bd9a8614..38acf8aa 100644 --- a/tests/test_locations.py +++ b/tests/test_locations.py @@ -12,6 +12,7 @@ import os import pathlib import platform +import sys from urllib.parse import urlsplit, uses_relative from pathlib import Path, PurePath, PureWindowsPath, PurePosixPath @@ -280,7 +281,10 @@ def test_normalize_url_with_base_unc_path(self,): self.assertEqual(url, 'file:////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd') url = normalize_url(r'dev\XMLSCHEMA\test.xsd', base_url=base_url_host_in_path) - self.assertEqual(url, 'file:////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd') + if sys.version_info < (3, 12, 4): + self.assertEqual(url, 'file:////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd') + else: + self.assertEqual(url, 'file://////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd') with patch.object(os, 'name', 'posix'): self.assertEqual(os.name, 'posix') @@ -294,7 +298,10 @@ def test_normalize_url_with_base_unc_path(self,): self.assertEqual(url, 'file:////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd') url = normalize_url(r'dev/XMLSCHEMA/test.xsd', base_url=base_url_host_in_path) - self.assertEqual(url, 'file:////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd') + if sys.version_info < (3, 12, 4): + self.assertEqual(url, 'file:////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd') + else: + self.assertEqual(url, 'file://////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd') def test_normalize_url_slashes(self): # Issue #116 @@ -311,10 +318,16 @@ def test_normalize_url_slashes(self): self.assertRegex(normalize_url('/root/dir1/schema.xsd'), f'file://{DRIVE_REGEX}/root/dir1/schema.xsd') - self.assertRegex(normalize_url('////root/dir1/schema.xsd'), - f'file://{DRIVE_REGEX}//root/dir1/schema.xsd') - self.assertRegex(normalize_url('dir2/schema.xsd', '////root/dir1'), - f'file://{DRIVE_REGEX}//root/dir1/dir2/schema.xsd') + if sys.version_info < (3, 12, 4): + self.assertRegex(normalize_url('////root/dir1/schema.xsd'), + f'file://{DRIVE_REGEX}//root/dir1/schema.xsd') + self.assertRegex(normalize_url('dir2/schema.xsd', '////root/dir1'), + f'file://{DRIVE_REGEX}//root/dir1/dir2/schema.xsd') + else: + self.assertRegex(normalize_url('////root/dir1/schema.xsd'), + f'file://{DRIVE_REGEX}////root/dir1/schema.xsd') + self.assertRegex(normalize_url('dir2/schema.xsd', '////root/dir1'), + f'file://{DRIVE_REGEX}////root/dir1/dir2/schema.xsd') self.assertEqual(normalize_url('//root/dir1/schema.xsd'), 'file:////root/dir1/schema.xsd') diff --git a/tox.ini b/tox.ini index dae4e1e4..38af4e0a 100644 --- a/tox.ini +++ b/tox.ini @@ -48,7 +48,7 @@ commands = [testenv:mypy-py{38,39,310,311,312,py3}] deps = - mypy==1.10.0 + mypy==1.11.0 elementpath==4.4.0 lxml-stubs jinja2 @@ -69,7 +69,7 @@ deps = elementpath>=4.4.0, <5.0.0 lxml jinja2 - mypy==1.10.0 + mypy==1.11.0 lxml-stubs commands = pytest tests -ra diff --git a/xmlschema/__init__.py b/xmlschema/__init__.py index 70e724f9..10f3e08f 100644 --- a/xmlschema/__init__.py +++ b/xmlschema/__init__.py @@ -33,7 +33,7 @@ XMLSchema, XMLSchema10, XMLSchema11, XsdComponent, XsdType, XsdElement, XsdAttribute ) -__version__ = '3.3.1' +__version__ = '3.3.2' __author__ = "Davide Brunato" __contact__ = "brunato@sissa.it" __copyright__ = "Copyright 2016-2024, SISSA" diff --git a/xmlschema/locations.py b/xmlschema/locations.py index 769aac7b..d0bf4267 100644 --- a/xmlschema/locations.py +++ b/xmlschema/locations.py @@ -71,9 +71,12 @@ def from_uri(cls, uri: str) -> 'LocationPath': return LocationPosixPath(unquote(parts.path)) if parts.scheme == 'file': - if path.startswith('/') and ntpath.splitdrive(path[1:])[0]: + path_start = path[:4].replace('\\', '/') + if path_start.startswith(('////', '///')): + pass + elif path_start.startswith('/') and ntpath.splitdrive(path[1:])[0]: return LocationWindowsPath(unquote(path[1:])) - elif path.startswith(('//', '/\\')) and ntpath.splitdrive(path[2:])[0]: + elif path_start.startswith('//') and ntpath.splitdrive(path[2:])[0]: raise XMLSchemaValueError(f"Invalid URI {uri!r}") if ntpath.splitdrive(path)[0] or '\\' in path: