Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_normalize_url_slashes and test_normalize_url_with_base_unc_path fail with Python 3.13 #408

Closed
glaubitz opened this issue Jul 22, 2024 · 2 comments

Comments

@glaubitz
Copy link

On Python 3.13, the tests tests test_normalize_url_slashes and test_normalize_url_with_base_unc_path fail with:

[   44s] =================================== FAILURES ===================================
[   44s] ___________________ TestLocations.test_normalize_url_slashes ___________________
[   44s] 
[   44s] self = <tests.test_locations.TestLocations testMethod=test_normalize_url_slashes>
[   44s] 
[   44s]     def test_normalize_url_slashes(self):
[   44s]         # Issue #116
[   44s]         url = '//anaconda/envs/testenv/lib/python3.6/site-packages/xmlschema/validators/schemas/'
[   44s]         if os.name == 'posix':
[   44s]             normalize_url(url)
[   44s]             self.assertEqual(normalize_url(url), pathlib.PurePath(url).as_uri())
[   44s]         else:
[   44s]             # On Windows // is interpreted as a network share UNC path
[   44s]             self.assertEqual(os.name, 'nt')
[   44s]             self.assertEqual(normalize_url(url),
[   44s]                              pathlib.PurePath(url).as_uri().replace('file://', 'file:////'))
[   44s]     
[   44s]         self.assertRegex(normalize_url('/root/dir1/schema.xsd'),
[   44s]                          f'file://{DRIVE_REGEX}/root/dir1/schema.xsd')
[   44s]     
[   44s] >       self.assertRegex(normalize_url('////root/dir1/schema.xsd'),
[   44s]                          f'file://{DRIVE_REGEX}//root/dir1/schema.xsd')
[   44s] E       AssertionError: Regex didn't match: 'file:////root/dir1/schema.xsd' not found in 'file://////root/dir1/schema.xsd'
[   44s] 
[   44s] tests/test_locations.py:314: AssertionError
[   44s] _____________ TestLocations.test_normalize_url_with_base_unc_path ______________
[   44s] 
[   44s] self = <tests.test_locations.TestLocations testMethod=test_normalize_url_with_base_unc_path>
[   44s] 
[   44s]     def test_normalize_url_with_base_unc_path(self,):
[   44s]         base_unc_path = '\\\\filer01\\MY_HOME\\'
[   44s]         base_url = PureWindowsPath(base_unc_path).as_uri()
[   44s]         self.assertEqual(str(PureWindowsPath(base_unc_path)), base_unc_path)
[   44s]         self.assertEqual(base_url, 'file://filer01/MY_HOME/')
[   44s]     
[   44s]         # Same UNC path as URI with the host inserted in path
[   44s]         base_url_host_in_path = base_url.replace('file://', 'file:////')
[   44s]         self.assertEqual(base_url_host_in_path, 'file:////filer01/MY_HOME/')
[   44s]     
[   44s]         self.assertEqual(normalize_url(base_unc_path), base_url_host_in_path)
[   44s]     
[   44s]         with patch.object(os, 'name', 'nt'):
[   44s]             self.assertEqual(os.name, 'nt')
[   44s]             path = PurePath('dir/file')
[   44s]             self.assertIs(path.__class__, PureWindowsPath)
[   44s]     
[   44s]             url = normalize_url(r'dev\XMLSCHEMA\test.xsd', base_url=base_unc_path)
[   44s]             self.assertEqual(url, 'file:////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd')
[   44s]     
[   44s]             url = normalize_url(r'dev\XMLSCHEMA\test.xsd', base_url=base_url)
[   44s]             self.assertEqual(url, 'file:////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd')
[   44s]     
[   44s]             url = normalize_url(r'dev\XMLSCHEMA\test.xsd', base_url=base_url_host_in_path)
[   44s] >           self.assertEqual(url, 'file:////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd')
[   44s] E           AssertionError: 'file://///filer01/MY_HOME/dev/XMLSCHEMA/test.xsd' != 'file:////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd'
[   44s] E           - file://///filer01/MY_HOME/dev/XMLSCHEMA/test.xsd
[   44s] E           ?      -
[   44s] E           + file:////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd
[   44s] 
[   44s] tests/test_locations.py:283: AssertionError
[   44s] =========================== short test summary info ============================
[   44s] FAILED tests/test_locations.py::TestLocations::test_normalize_url_slashes - A...
[   44s] FAILED tests/test_locations.py::TestLocations::test_normalize_url_with_base_unc_path
[   44s] ================= 2 failed, 1245 passed, 115 skipped in 15.54s =================
@glaubitz glaubitz changed the title test_normalize_url_slashes and test_normalize_url_with_base_unc_path fail with Python 3..13 test_normalize_url_slashes and test_normalize_url_with_base_unc_path fail with Python 3.13 Jul 29, 2024
brunato added a commit that referenced this issue Jul 29, 2024
brunato added a commit that referenced this issue Jul 29, 2024
@brunato
Copy link
Member

brunato commented Jul 29, 2024

A fix for this is available with v3.3.2. The problem is the same of #405 (a change in urllib.parse.urlunsplit included in Python 3.12.4 and then in the following beta release of Python 3.13).

Thank you

@brunato brunato closed this as completed Jul 29, 2024
@glaubitz
Copy link
Author

A fix for this is available with v3.3.2. The problem is the same of #405 (a change in urllib.parse.urlunsplit included in Python 3.12.4 and then in the following beta release of Python 3.13).

Thank you

Thanks a lot! I already updated the python-xmlschema package in openSUSE to 3.3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants