MCPcopy Index your code
hub / github.com/python/cpython / test_getpath_abspath_win32

Method test_getpath_abspath_win32

Lib/test/test_embed.py:1753–1778  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1751
1752 @unittest.skipUnless(MS_WINDOWS, 'specific to Windows')
1753 def test_getpath_abspath_win32(self):
1754 # Check _Py_abspath() is passed a backslashed path not to fall back to
1755 # GetFullPathNameW() on startup, which (re-)normalizes the path overly.
1756 # Currently, _Py_normpath() doesn't trim trailing dots and spaces.
1757 CASES = [
1758 ("C:/a. . .", "C:\\a. . ."),
1759 ("C:\\a. . .", "C:\\a. . ."),
1760 ("\\\\?\\C:////a////b. . .", "\\\\?\\C:\\a\\b. . ."),
1761 ("//a/b/c. . .", "\\\\a\\b\\c. . ."),
1762 ("\\\\a\\b\\c. . .", "\\\\a\\b\\c. . ."),
1763 ("a. . .", f"{os.getcwd()}\\a"), # relpath gets fully normalized
1764 ]
1765 out, err = self.run_embedded_interpreter(
1766 "test_init_initialize_config",
1767 env={**remove_python_envvars(),
1768 "PYTHONPATH": os.path.pathsep.join(c[0] for c in CASES)}
1769 )
1770 self.assertEqual(err, "")
1771 try:
1772 out = json.loads(out)
1773 except json.JSONDecodeError:
1774 self.fail(f"fail to decode stdout: {out!r}")
1775
1776 results = out['config']["module_search_paths"]
1777 for (_, expected), result in zip(CASES, results):
1778 self.assertEqual(result, expected)
1779
1780 def test_global_pathconfig(self):
1781 # Test C API functions getting the path configuration:

Callers

nothing calls this directly

Calls 6

remove_python_envvarsFunction · 0.85
joinMethod · 0.45
assertEqualMethod · 0.45
loadsMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected