예제 #1
0
def test_dir_read(testfs):
    dh = lfs.dir_open(testfs, '')
    info = lfs.dir_read(testfs, dh)
    assert info.name == '.'

    info = lfs.dir_read(testfs, dh)
    assert info.name == '..'

    info = lfs.dir_read(testfs, dh)
    assert info.name == 'testdir'
예제 #2
0
def test_dir_read_overflow(testfs):
    dh = lfs.dir_open(testfs, '')

    # There are three directories: ., .., testdir
    for _ in range(3):
        info = lfs.dir_read(testfs, dh)
        assert info is not None

    # If we read one more, we should get None
    info = lfs.dir_read(testfs, dh)
    assert info is None
예제 #3
0
def test_dir_rewind(testfs):
    dirs = ['.', '..', 'testdir']
    dh = lfs.dir_open(testfs, '')

    for name in dirs:
        info = lfs.dir_read(testfs, dh)
        assert info.name == name

    lfs.dir_rewind(testfs, dh)

    for name in dirs:
        info = lfs.dir_read(testfs, dh)
        assert info.name == name
예제 #4
0
def test_dir_close(testfs):
    dh = lfs.dir_open(testfs, 'testdir')
    lfs.dir_close(testfs, dh)
예제 #5
0
def test_dir_open(testfs):
    dh = lfs.dir_open(testfs, 'testdir')
    assert dh != None