glob: test_glob: Consistently disable tests for bytes arguments.

MicroPython doen't fully implement str vs bytes dichotomy on "os" module
level, so it doesn't work for glob either.
pull/216/head
Paul Sokolovsky 2017-10-10 17:30:41 +03:00
rodzic 56434974a7
commit 8cca4dffce
1 zmienionych plików z 6 dodań i 4 usunięć

Wyświetl plik

@ -48,8 +48,9 @@ class GlobTests(unittest.TestCase):
res = glob.glob(p) res = glob.glob(p)
self.assertEqual(list(glob.iglob(p)), res) self.assertEqual(list(glob.iglob(p)), res)
bres = [os.fsencode(x) for x in res] bres = [os.fsencode(x) for x in res]
self.assertEqual(glob.glob(os.fsencode(p)), bres) # Bytes globbing is not support on MicroPython
self.assertEqual(list(glob.iglob(os.fsencode(p))), bres) # self.assertEqual(glob.glob(os.fsencode(p)), bres)
# self.assertEqual(list(glob.iglob(os.fsencode(p))), bres)
return res return res
def assertSequencesEqual_noorder(self, l1, l2): def assertSequencesEqual_noorder(self, l1, l2):
@ -121,6 +122,7 @@ class GlobTests(unittest.TestCase):
{self.norm('aaa') + os.sep, self.norm('aab') + os.sep}, {self.norm('aaa') + os.sep, self.norm('aab') + os.sep},
]) ])
@unittest.skip("unsupported on MicroPython")
def test_glob_bytes_directory_with_trailing_slash(self): def test_glob_bytes_directory_with_trailing_slash(self):
# Same as test_glob_directory_with_trailing_slash, but with a # Same as test_glob_directory_with_trailing_slash, but with a
# bytes argument. # bytes argument.
@ -158,8 +160,8 @@ class GlobTests(unittest.TestCase):
eq(self.glob('sym1'), [self.norm('sym1')]) eq(self.glob('sym1'), [self.norm('sym1')])
eq(self.glob('sym2'), [self.norm('sym2')]) eq(self.glob('sym2'), [self.norm('sym2')])
# @unittest.skipUnless(sys.platform == "win32", "Win32 specific test") @unittest.skipUnless(sys.platform == "win32", "Win32 specific test")
def _test_glob_magic_in_drive(self): def test_glob_magic_in_drive(self):
eq = self.assertSequencesEqual_noorder eq = self.assertSequencesEqual_noorder
eq(glob.glob('*:'), []) eq(glob.glob('*:'), [])
eq(glob.glob(b'*:'), []) eq(glob.glob(b'*:'), [])