summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unittest
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2024-01-13 07:36:05 (GMT)
committerGitHub <noreply@github.com>2024-01-13 07:36:05 (GMT)
commite4ff131e01184b68d868cfd241a03f8b7d2e0ff9 (patch)
tree0292c431d2dd38f47a265d1d25d961ef86ec43b7 /Lib/test/test_unittest
parentdac1da21218a406652b35919aa2118cc32d4c65a (diff)
downloadcpython-e4ff131e01184b68d868cfd241a03f8b7d2e0ff9.zip
cpython-e4ff131e01184b68d868cfd241a03f8b7d2e0ff9.tar.gz
cpython-e4ff131e01184b68d868cfd241a03f8b7d2e0ff9.tar.bz2
GH-44626, GH-105476: Fix `ntpath.isabs()` handling of part-absolute paths (#113829)
On Windows, `os.path.isabs()` now returns `False` when given a path that starts with exactly one (back)slash. This is more compatible with other functions in `os.path`, and with Microsoft's own documentation. Also adjust `pathlib.PureWindowsPath.is_absolute()` to call `ntpath.isabs()`, which corrects its handling of partial UNC/device paths like `//foo`. Co-authored-by: Jon Foster <jon@jon-foster.co.uk>
Diffstat (limited to 'Lib/test/test_unittest')
-rw-r--r--Lib/test/test_unittest/test_program.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_unittest/test_program.py b/Lib/test/test_unittest/test_program.py
index d8f5d36..7241cf5 100644
--- a/Lib/test/test_unittest/test_program.py
+++ b/Lib/test/test_unittest/test_program.py
@@ -459,8 +459,8 @@ class TestCommandLineArgs(unittest.TestCase):
def testParseArgsAbsolutePathsThatCannotBeConverted(self):
program = self.program
- # even on Windows '/...' is considered absolute by os.path.abspath
- argv = ['progname', '/foo/bar/baz.py', '/green/red.py']
+ drive = os.path.splitdrive(os.getcwd())[0]
+ argv = ['progname', f'{drive}/foo/bar/baz.py', f'{drive}/green/red.py']
self._patch_isfile(argv)
program.createTests = lambda: None