示例#1
0
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)
示例#2
0
def test_malloc_fail(fixt_dir):
    with raises(MemoryError):
        getdents_raw(fixt_dir, sys.maxsize)
示例#3
0
def test_small_buffer(fixt_dir):
    with raises(ValueError):
        getdents_raw(fixt_dir, MIN_GETDENTS_BUFF_SIZE - 1)
示例#4
0
def test_not_a_directory(fixt_regular_file):
    with raises(NotADirectoryError):
        getdents_raw(fixt_regular_file, MIN_GETDENTS_BUFF_SIZE)
示例#5
0
def test_malloc_fail(fixt_dir):
    with raises(MemoryError):
        getdents_raw(fixt_dir, 1 << 62)