Skip to content

Commit 021ca08

Browse files
Fix the tests on Windows
test_html_doc contained the URL in the old format, in which the drive letter and backslashes of a Windows path were percent-encoded. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 5ee9f1d commit 021ca08

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/test/test_pydoc/test_pydoc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ def test_html_doc(self):
430430
expected_lines = [line.strip() for line in expected_lines if line]
431431
self.assertEqual(text_lines, expected_lines)
432432
mod_file = inspect.getabsfile(pydoc_mod)
433-
mod_url = urllib.parse.quote(mod_file)
433+
mod_url = urllib.request.pathname2url(mod_file)
434434
self.assertIn(mod_url, result)
435435
self.assertIn(mod_file, result)
436436
self.assertIn(doc_loc, result)
@@ -1044,7 +1044,7 @@ def test_html_doc_undecodable_path(self):
10441044
with captured_stdout():
10451045
pydoc.writedoc(mod)
10461046
# The link contains the percent-encoded path...
1047-
path = os.fsdecode(os.path.join(subdir, b'undecodable_mod.py'))
1047+
path = inspect.getabsfile(mod)
10481048
self.assertIn(urllib.request.pathname2url(path), doc)
10491049
# ...and the page can be written and served as UTF-8.
10501050
with open('undecodable_mod.html', encoding='utf-8') as f:

0 commit comments

Comments
 (0)