diff --git a/mkdocs/tests/build_tests.py b/mkdocs/tests/build_tests.py index 7d202ec6..3e649ef5 100644 --- a/mkdocs/tests/build_tests.py +++ b/mkdocs/tests/build_tests.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import sys import unittest from unittest import mock @@ -180,7 +179,8 @@ class BuildTests(PathAssertionMixin, unittest.TestCase): self.assertEqual(context['extra_css'], ['../../style.css']) self.assertEqual(context['extra_javascript'], ['../../script.js']) - @unittest.skipUnless(sys.platform.startswith("win"), "requires Windows") + # TODO: This shouldn't pass on Linux + # @unittest.skipUnless(sys.platform.startswith("win"), "requires Windows") def test_context_extra_css_path_warning(self): nav_cfg = [ {'Home': 'index.md'}, @@ -200,8 +200,8 @@ class BuildTests(PathAssertionMixin, unittest.TestCase): self.assertEqual(context['extra_css'], ['assets/style.css']) self.assertEqual( '\n'.join(cm.output), - "WARNING:mkdocs.utils:Path 'assets\\style.css' uses OS-specific separator '\\', " - "change it to '/' so it is recognized on other systems.", + "WARNING:mkdocs.utils:Path 'assets\\style.css' uses OS-specific separator '\\'. " + "That will be unsupported in a future release. Please change it to '/'.", ) def test_context_extra_css_js_no_page(self): diff --git a/mkdocs/tests/utils/utils_tests.py b/mkdocs/tests/utils/utils_tests.py index 9ea9b382..6e4d4f27 100644 --- a/mkdocs/tests/utils/utils_tests.py +++ b/mkdocs/tests/utils/utils_tests.py @@ -5,7 +5,6 @@ import logging import os import posixpath import stat -import sys import unittest from unittest import mock @@ -245,7 +244,8 @@ class UtilsTests(unittest.TestCase): urls = utils.create_media_urls(expected_results.keys(), page) self.assertEqual([v[i] for v in expected_results.values()], urls) - @unittest.skipUnless(sys.platform.startswith("win"), "requires Windows") + # TODO: This shouldn't pass on Linux + # @unittest.skipUnless(sys.platform.startswith("win"), "requires Windows") def test_create_media_urls_windows(self): expected_results = { 'local\\windows\\file\\jquery.js': [ diff --git a/mkdocs/utils/__init__.py b/mkdocs/utils/__init__.py index f4b9c696..c92aa609 100644 --- a/mkdocs/utils/__init__.py +++ b/mkdocs/utils/__init__.py @@ -304,12 +304,12 @@ def normalize_url(path: str, page: Optional[Page] = None, base: str = '') -> str def _get_norm_url(path: str) -> Tuple[str, bool]: if not path: path = '.' - elif os.sep != '/' and os.sep in path: + elif '\\' in path: log.warning( - f"Path '{path}' uses OS-specific separator '{os.sep}', " - f"change it to '/' so it is recognized on other systems." + f"Path '{path}' uses OS-specific separator '\\'. " + f"That will be unsupported in a future release. Please change it to '/'." ) - path = path.replace(os.sep, '/') + path = path.replace('\\', '/') # Allow links to be fully qualified URLs parsed = urlsplit(path) if parsed.scheme or parsed.netloc or path.startswith(('/', '#')):