def test_getdents_raw(fixt_dir): iterator = iter(sorted( getdents_raw( fixt_dir, MIN_GETDENTS_BUFF_SIZE, ), key=lambda d: d[2], )) assert next(iterator) == (ANY, DT_DIR, '.') assert next(iterator) == (ANY, DT_DIR, '..') for i, entry in enumerate(iterator): assert entry == (ANY, DT_DIR, 'subdir%d' % i)
def test_malloc_fail(fixt_dir): with raises(MemoryError): getdents_raw(fixt_dir, sys.maxsize)
def test_small_buffer(fixt_dir): with raises(ValueError): getdents_raw(fixt_dir, MIN_GETDENTS_BUFF_SIZE - 1)
def test_not_a_directory(fixt_regular_file): with raises(NotADirectoryError): getdents_raw(fixt_regular_file, MIN_GETDENTS_BUFF_SIZE)
def test_malloc_fail(fixt_dir): with raises(MemoryError): getdents_raw(fixt_dir, 1 << 62)