Skip to content

Commit 1d242c3

Browse files
committed
Fix Windows test_ntpath failures.
1 parent 70f9db5 commit 1d242c3

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
@@ -2,6 +2,7 @@
22
import ntpath
33
import os
44
import string
5+
import subprocess
56
import sys
67
import unittest
78
import warnings
@@ -485,20 +486,20 @@ def test_realpath_strict(self):
485486
# gh-106242: Embedded nulls should raise OSError (not ValueError)
486487
self.assertRaises(OSError, ntpath.realpath, ABSTFN + "\0spam", strict=True)
487488

488-
self.assertRaises(OSError, realpath, path, strict=True)
489-
self.assertRaises(OSError, realpath, path, strict=ALLOW_MISSING)
489+
self.assertRaises(OSError, ntpath.realpath, path, strict=True)
490+
self.assertRaises(OSError, ntpath.realpath, path, strict=ALLOW_MISSING)
490491
path = ABSTFNb + b'\x00'
491492
self.assertEqual(realpath(path, strict=False), path)
492-
self.assertRaises(OSError, realpath, path, strict=True)
493-
self.assertRaises(OSError, realpath, path, strict=ALLOW_MISSING)
493+
self.assertRaises(OSError, ntpath.realpath, path, strict=True)
494+
self.assertRaises(OSError, ntpath.realpath, path, strict=ALLOW_MISSING)
494495
path = ABSTFN + '\\nonexistent\\x\x00'
495496
self.assertEqual(realpath(path, strict=False), path)
496-
self.assertRaises(OSError, realpath, path, strict=True)
497-
self.assertRaises(OSError, realpath, path, strict=ALLOW_MISSING)
497+
self.assertRaises(OSError, ntpath.realpath, path, strict=True)
498+
self.assertRaises(OSError, ntpath.realpath, path, strict=ALLOW_MISSING)
498499
path = ABSTFNb + b'\\nonexistent\\x\x00'
499500
self.assertEqual(realpath(path, strict=False), path)
500-
self.assertRaises(OSError, realpath, path, strict=True)
501-
self.assertRaises(OSError, realpath, path, strict=ALLOW_MISSING)
501+
self.assertRaises(OSError, ntpath.realpath, path, strict=True)
502+
self.assertRaises(OSError, ntpath.realpath, path, strict=ALLOW_MISSING)
502503
path = ABSTFN + '\x00\\..'
503504
self.assertEqual(realpath(path, strict=False), os.getcwd())
504505
self.assertEqual(realpath(path, strict=True), os.getcwd())
@@ -509,11 +510,11 @@ def test_realpath_strict(self):
509510
self.assertEqual(realpath(path, strict=ALLOW_MISSING), os.getcwdb())
510511
path = ABSTFN + '\\nonexistent\\x\x00\\..'
511512
self.assertEqual(realpath(path, strict=False), ABSTFN + '\\nonexistent')
512-
self.assertRaises(OSError, realpath, path, strict=True)
513+
self.assertRaises(OSError, ntpath.realpath, path, strict=True)
513514
self.assertEqual(realpath(path, strict=ALLOW_MISSING), ABSTFN + '\\nonexistent')
514515
path = ABSTFNb + b'\\nonexistent\\x\x00\\..'
515516
self.assertEqual(realpath(path, strict=False), ABSTFNb + b'\\nonexistent')
516-
self.assertRaises(OSError, realpath, path, strict=True)
517+
self.assertRaises(OSError, ntpath.realpath, path, strict=True)
517518
self.assertEqual(realpath(path, strict=ALLOW_MISSING), ABSTFNb + b'\\nonexistent')
518519

519520
@unittest.skipUnless(HAVE_GETFINALPATHNAME, 'need _getfinalpathname')
@@ -523,17 +524,17 @@ def test_realpath_invalid_unicode_paths(self, kwargs):
523524
ABSTFN = ntpath.abspath(os_helper.TESTFN)
524525
ABSTFNb = os.fsencode(ABSTFN)
525526
path = ABSTFNb + b'\xff'
526-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
527-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
527+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
528+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
528529
path = ABSTFNb + b'\\nonexistent\\\xff'
529-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
530-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
530+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
531+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
531532
path = ABSTFNb + b'\xff\\..'
532-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
533-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
533+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
534+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
534535
path = ABSTFNb + b'\\nonexistent\\\xff\\..'
535-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
536-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
536+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
537+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
537538

538539
@os_helper.skip_unless_symlink
539540
@unittest.skipUnless(HAVE_GETFINALPATHNAME, 'need _getfinalpathname')

0 commit comments

Comments
 (0)