Skip to content

Commit 630ffa3

Browse files
committed
Fix Windows test_ntpath failures.
1 parent 6d4d4d6 commit 630ffa3

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

Lib/test/test_ntpath.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import ntpath
22
import os
33
import string
4+
import subprocess
45
import sys
56
import unittest
67
import warnings
@@ -423,20 +424,20 @@ def test_realpath_strict(self):
423424
# gh-106242: Embedded nulls should raise OSError (not ValueError)
424425
self.assertRaises(OSError, ntpath.realpath, ABSTFN + "\0spam", strict=True)
425426

426-
self.assertRaises(OSError, realpath, path, strict=True)
427-
self.assertRaises(OSError, realpath, path, strict=ALLOW_MISSING)
427+
self.assertRaises(OSError, ntpath.realpath, path, strict=True)
428+
self.assertRaises(OSError, ntpath.realpath, path, strict=ALLOW_MISSING)
428429
path = ABSTFNb + b'\x00'
429430
self.assertEqual(realpath(path, strict=False), path)
430-
self.assertRaises(OSError, realpath, path, strict=True)
431-
self.assertRaises(OSError, realpath, path, strict=ALLOW_MISSING)
431+
self.assertRaises(OSError, ntpath.realpath, path, strict=True)
432+
self.assertRaises(OSError, ntpath.realpath, path, strict=ALLOW_MISSING)
432433
path = ABSTFN + '\\nonexistent\\x\x00'
433434
self.assertEqual(realpath(path, strict=False), path)
434-
self.assertRaises(OSError, realpath, path, strict=True)
435-
self.assertRaises(OSError, realpath, path, strict=ALLOW_MISSING)
435+
self.assertRaises(OSError, ntpath.realpath, path, strict=True)
436+
self.assertRaises(OSError, ntpath.realpath, path, strict=ALLOW_MISSING)
436437
path = ABSTFNb + b'\\nonexistent\\x\x00'
437438
self.assertEqual(realpath(path, strict=False), path)
438-
self.assertRaises(OSError, realpath, path, strict=True)
439-
self.assertRaises(OSError, realpath, path, strict=ALLOW_MISSING)
439+
self.assertRaises(OSError, ntpath.realpath, path, strict=True)
440+
self.assertRaises(OSError, ntpath.realpath, path, strict=ALLOW_MISSING)
440441
path = ABSTFN + '\x00\\..'
441442
self.assertEqual(realpath(path, strict=False), os.getcwd())
442443
self.assertEqual(realpath(path, strict=True), os.getcwd())
@@ -447,11 +448,11 @@ def test_realpath_strict(self):
447448
self.assertEqual(realpath(path, strict=ALLOW_MISSING), os.getcwdb())
448449
path = ABSTFN + '\\nonexistent\\x\x00\\..'
449450
self.assertEqual(realpath(path, strict=False), ABSTFN + '\\nonexistent')
450-
self.assertRaises(OSError, realpath, path, strict=True)
451+
self.assertRaises(OSError, ntpath.realpath, path, strict=True)
451452
self.assertEqual(realpath(path, strict=ALLOW_MISSING), ABSTFN + '\\nonexistent')
452453
path = ABSTFNb + b'\\nonexistent\\x\x00\\..'
453454
self.assertEqual(realpath(path, strict=False), ABSTFNb + b'\\nonexistent')
454-
self.assertRaises(OSError, realpath, path, strict=True)
455+
self.assertRaises(OSError, ntpath.realpath, path, strict=True)
455456
self.assertEqual(realpath(path, strict=ALLOW_MISSING), ABSTFNb + b'\\nonexistent')
456457

457458
@unittest.skipUnless(HAVE_GETFINALPATHNAME, 'need _getfinalpathname')
@@ -461,17 +462,17 @@ def test_realpath_invalid_unicode_paths(self, kwargs):
461462
ABSTFN = ntpath.abspath(os_helper.TESTFN)
462463
ABSTFNb = os.fsencode(ABSTFN)
463464
path = ABSTFNb + b'\xff'
464-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
465-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
465+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
466+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
466467
path = ABSTFNb + b'\\nonexistent\\\xff'
467-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
468-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
468+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
469+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
469470
path = ABSTFNb + b'\xff\\..'
470-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
471-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
471+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
472+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
472473
path = ABSTFNb + b'\\nonexistent\\\xff\\..'
473-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
474-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
474+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
475+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
475476

476477
@os_helper.skip_unless_symlink
477478
@unittest.skipUnless(HAVE_GETFINALPATHNAME, 'need _getfinalpathname')

0 commit comments

Comments
 (0)