5
>>> from nose.util import ls_tree
7
>>> dir_path = tempfile.mkdtemp()
9
>>> def create_file(filename):
10
... fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0666)
13
>>> os.mkdir(os.path.join(dir_path, "top"))
14
>>> os.mkdir(os.path.join(dir_path, "top/dir"))
15
>>> os.mkdir(os.path.join(dir_path, "top/dir2"))
16
>>> os.mkdir(os.path.join(dir_path, "top/dir3"))
17
>>> os.mkdir(os.path.join(dir_path, "top/dir/dir"))
18
>>> os.mkdir(os.path.join(dir_path, "top/dir/dir2"))
19
>>> os.mkdir(os.path.join(dir_path, "top/.svn"))
20
>>> os.mkdir(os.path.join(dir_path, "top/.notsvn"))
21
>>> os.mkdir(os.path.join(dir_path, "top/dir/.svn"))
22
>>> os.mkdir(os.path.join(dir_path, "top/dir/.notsvn"))
23
>>> create_file(os.path.join(dir_path, "top/file"))
24
>>> create_file(os.path.join(dir_path, "top/backup_file~"))
25
>>> create_file(os.path.join(dir_path, "top/file2"))
26
>>> create_file(os.path.join(dir_path, "top/dir/file"))
27
>>> create_file(os.path.join(dir_path, "top/dir/dir/file"))
28
>>> create_file(os.path.join(dir_path, "top/dir/dir/file2"))
29
>>> create_file(os.path.join(dir_path, "top/dir/backup_file~"))
30
>>> create_file(os.path.join(dir_path, "top/dir2/file"))
32
Note that files matching skip_pattern (by default SVN files,
33
backup files and compiled Python files) are ignored
35
>>> print ls_tree(os.path.join(dir_path, "top"))
50
>>> shutil.rmtree(dir_path)