4 # Author: engelbert gruber <grubert@users.sourceforge.net>
5 # Copyright: This module has been placed in the public domain.
8 test buildhtml options, because ``--local`` is broken.
12 --recurse Recursively scan subdirectories for files to process.
14 --local Do not scan subdirectories for files to process.
15 --prune=<directory> Do not process files in <directory>. This option may
16 be used more than once to specify multiple
18 --ignore=<patterns> Recursively ignore files or directories matching any
19 of the given wildcard (shell globbing) patterns
20 (separated by colons). Default: ".svn:CVS"
21 --silent Work silently (no progress messages). Independent of
29 def process_and_return_filelist(options
):
32 cin
, cout
= os
.popen4("../buildhtml.py "+options
)
37 # BUG no colon in filename/path allowed
38 item
= ln
.split(":")[-1].strip()
39 if ln
.startswith(" "):
45 class BuildHtmlTests(unittest
.TestCase
):
46 tree
= ( "_tmp_test_tree",
47 "_tmp_test_tree/one.txt",
48 "_tmp_test_tree/two.txt",
49 "_tmp_test_tree/dir1",
50 "_tmp_test_tree/dir1/one.txt",
51 "_tmp_test_tree/dir1/two.txt",
52 "_tmp_test_tree/dir2",
53 "_tmp_test_tree/dir2/one.txt",
54 "_tmp_test_tree/dir2/two.txt",
55 "_tmp_test_tree/dir2/sub",
56 "_tmp_test_tree/dir2/sub/one.txt",
57 "_tmp_test_tree/dir2/sub/two.txt",
61 self
.root
= os
.tempnam()
64 s
= os
.path
.join(self
.root
, s
)
68 open(s
, "w").write("dummy")
71 for i
in range(len(self
.tree
) - 1, -1, -1):
72 s
= os
.path
.join(self
.root
, self
.tree
[i
])
80 opts
= "--dry-run "+ self
.root
81 dirs
, files
= process_and_return_filelist( opts
)
82 self
.assertEquals(files
.count("one.txt"), 4)
85 opts
= "--dry-run --local "+ self
.root
86 dirs
, files
= process_and_return_filelist( opts
)
87 self
.assertEquals( len(dirs
), 1)
88 self
.assertEquals( files
, [])
90 if __name__
== '__main__':