diff options
author | Brian Curtin <brian.curtin@gmail.com> | 2010-09-06 19:46:17 (GMT) |
---|---|---|
committer | Brian Curtin <brian.curtin@gmail.com> | 2010-09-06 19:46:17 (GMT) |
commit | 13a0db5ddbb53c504574743207524b037945552c (patch) | |
tree | 7041e536b3a6c01108de8b3862fca8e1c5eda79c /Lib/test | |
parent | 4bc12ef47dd57abda134fc0e90f946d862d8989e (diff) | |
download | cpython-13a0db5ddbb53c504574743207524b037945552c.zip cpython-13a0db5ddbb53c504574743207524b037945552c.tar.gz cpython-13a0db5ddbb53c504574743207524b037945552c.tar.bz2 |
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.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_ntpath.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py index 9f39aba..5609aee 100644 --- a/Lib/test/test_ntpath.py +++ b/Lib/test/test_ntpath.py @@ -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): |