Skip to content

Commit 0aaaeaa

Browse files
committed
Fix Windows test_ntpath failures.
1 parent 6b6a77a commit 0aaaeaa

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,5 +1,6 @@
11
import ntpath
22
import os
3+
import subprocess
34
import sys
45
import unittest
56
import warnings
@@ -349,20 +350,20 @@ def test_realpath_strict(self):
349350
self.assertRaises(FileNotFoundError, ntpath.realpath, ABSTFN, strict=True)
350351
self.assertRaises(FileNotFoundError, ntpath.realpath, ABSTFN + "2", strict=True)
351352

352-
self.assertRaises(OSError, realpath, path, strict=True)
353-
self.assertRaises(OSError, realpath, path, strict=ALLOW_MISSING)
353+
self.assertRaises(OSError, ntpath.realpath, path, strict=True)
354+
self.assertRaises(OSError, ntpath.realpath, path, strict=ALLOW_MISSING)
354355
path = ABSTFNb + b'\x00'
355356
self.assertEqual(realpath(path, strict=False), path)
356-
self.assertRaises(OSError, realpath, path, strict=True)
357-
self.assertRaises(OSError, realpath, path, strict=ALLOW_MISSING)
357+
self.assertRaises(OSError, ntpath.realpath, path, strict=True)
358+
self.assertRaises(OSError, ntpath.realpath, path, strict=ALLOW_MISSING)
358359
path = ABSTFN + '\\nonexistent\\x\x00'
359360
self.assertEqual(realpath(path, strict=False), path)
360-
self.assertRaises(OSError, realpath, path, strict=True)
361-
self.assertRaises(OSError, realpath, path, strict=ALLOW_MISSING)
361+
self.assertRaises(OSError, ntpath.realpath, path, strict=True)
362+
self.assertRaises(OSError, ntpath.realpath, path, strict=ALLOW_MISSING)
362363
path = ABSTFNb + b'\\nonexistent\\x\x00'
363364
self.assertEqual(realpath(path, strict=False), path)
364-
self.assertRaises(OSError, realpath, path, strict=True)
365-
self.assertRaises(OSError, realpath, path, strict=ALLOW_MISSING)
365+
self.assertRaises(OSError, ntpath.realpath, path, strict=True)
366+
self.assertRaises(OSError, ntpath.realpath, path, strict=ALLOW_MISSING)
366367
path = ABSTFN + '\x00\\..'
367368
self.assertEqual(realpath(path, strict=False), os.getcwd())
368369
self.assertEqual(realpath(path, strict=True), os.getcwd())
@@ -373,11 +374,11 @@ def test_realpath_strict(self):
373374
self.assertEqual(realpath(path, strict=ALLOW_MISSING), os.getcwdb())
374375
path = ABSTFN + '\\nonexistent\\x\x00\\..'
375376
self.assertEqual(realpath(path, strict=False), ABSTFN + '\\nonexistent')
376-
self.assertRaises(OSError, realpath, path, strict=True)
377+
self.assertRaises(OSError, ntpath.realpath, path, strict=True)
377378
self.assertEqual(realpath(path, strict=ALLOW_MISSING), ABSTFN + '\\nonexistent')
378379
path = ABSTFNb + b'\\nonexistent\\x\x00\\..'
379380
self.assertEqual(realpath(path, strict=False), ABSTFNb + b'\\nonexistent')
380-
self.assertRaises(OSError, realpath, path, strict=True)
381+
self.assertRaises(OSError, ntpath.realpath, path, strict=True)
381382
self.assertEqual(realpath(path, strict=ALLOW_MISSING), ABSTFNb + b'\\nonexistent')
382383

383384
@unittest.skipUnless(HAVE_GETFINALPATHNAME, 'need _getfinalpathname')
@@ -387,17 +388,17 @@ def test_realpath_invalid_unicode_paths(self, kwargs):
387388
ABSTFN = ntpath.abspath(os_helper.TESTFN)
388389
ABSTFNb = os.fsencode(ABSTFN)
389390
path = ABSTFNb + b'\xff'
390-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
391-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
391+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
392+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
392393
path = ABSTFNb + b'\\nonexistent\\\xff'
393-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
394-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
394+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
395+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
395396
path = ABSTFNb + b'\xff\\..'
396-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
397-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
397+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
398+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
398399
path = ABSTFNb + b'\\nonexistent\\\xff\\..'
399-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
400-
self.assertRaises(UnicodeDecodeError, realpath, path, **kwargs)
400+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
401+
self.assertRaises(UnicodeDecodeError, ntpath.realpath, path, **kwargs)
401402

402403
@os_helper.skip_unless_symlink
403404
@unittest.skipUnless(HAVE_GETFINALPATHNAME, 'need _getfinalpathname')

0 commit comments

Comments
 (0)