# Path: streamcorpus_pipeline/util.py



import logging
import os
import pytest
from streamcorpus_pipeline.util import rmtree
            observed.add(fpath)

            ## set the permissions so that nobody can even read it,
            ## and it should still get deleted.
            os.chmod(fpath, 0000)

    assert len(observed) == 1

    dirname = str(tmpdir.join('c'))
    assert len(os.listdir(dirname)) == 2

    logger.info(os.listdir(dirname))

    return path_to_delete

def test_rmtree_followlinks_True(tmpdir):
    path_to_delete = make_tree_with_symlink(tmpdir)
    rmtree(path_to_delete, followlinks=True)

    observed = set()
    for root, dir_names, file_names in os.walk(str(tmpdir.join('c')), followlinks=True):
        for fname in dir_names + file_names:
            fpath = os.path.join(root, fname)
            observed.add(fpath)

    logger.info('\n'.join(sorted(observed)))
    assert  len(observed) == 0

def test_rmtree_followlinks_False(tmpdir):
    path_to_delete = make_tree_with_symlink(tmpdir)

# Path: streamcorpus_pipeline/util.py



# Path: streamcorpus_pipeline/tests/test_rmtree.py
import logging
import os
import pytest
from streamcorpus_pipeline.util import rmtree

            observed.add(fpath)

            ## set the permissions so that nobody can even read it,
            ## and it should still get deleted.
            os.chmod(fpath, 0000)

    assert len(observed) == 1

    dirname = str(tmpdir.join('c'))
    assert len(os.listdir(dirname)) == 2

    logger.info(os.listdir(dirname))

    return path_to_delete

def test_rmtree_followlinks_True(tmpdir):
    path_to_delete = make_tree_with_symlink(tmpdir)
    rmtree(path_to_delete, followlinks=True)

    observed = set()
    for root, dir_names, file_names in os.walk(str(tmpdir.join('c')), followlinks=True):
        for fname in dir_names + file_names:
            fpath = os.path.join(root, fname)
            observed.add(fpath)

    logger.info('\n'.join(sorted(observed)))
    assert  len(observed) == 0

def test_rmtree_followlinks_False(tmpdir):
    path_to_delete = make_tree_with_symlink(tmpdir)

    rmtree(path_to_delete, followlinks=False)