mirror of
https://github.com/python/cpython.git
synced 2025-08-27 20:25:18 +00:00
Fix some errors that #7566 introduced on non-Windows platforms due to
an ImportError. Rearranged the import, faked out the implementation when the import fails, and reorganized a test that depends on Win32 behavior.
This commit is contained in:
parent
4bc12ef47d
commit
13a0db5ddb
2 changed files with 14 additions and 7 deletions
|
@ -1,5 +1,6 @@
|
|||
import ntpath
|
||||
import os
|
||||
import sys
|
||||
from test.support import TestFailed
|
||||
from test import support, test_genericpath
|
||||
from tempfile import TemporaryFile
|
||||
|
@ -244,11 +245,12 @@ class TestNtpath(unittest.TestCase):
|
|||
self.assertTrue(ntpath.sameopenfile(tf1.fileno(), tf1.fileno()))
|
||||
# Make sure different files are really different
|
||||
self.assertFalse(ntpath.sameopenfile(tf1.fileno(), tf2.fileno()))
|
||||
# Make sure invalid values don't cause issues
|
||||
with self.assertRaises(ValueError):
|
||||
# Invalid file descriptors shouldn't display assert
|
||||
# dialogs (#4804)
|
||||
ntpath.sameopenfile(-1, -1)
|
||||
# Make sure invalid values don't cause issues on win32
|
||||
if sys.platform == "win32":
|
||||
with self.assertRaises(ValueError):
|
||||
# Invalid file descriptors shouldn't display assert
|
||||
# dialogs (#4804)
|
||||
ntpath.sameopenfile(-1, -1)
|
||||
|
||||
|
||||
class NtCommonTest(test_genericpath.CommonTest):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue