def test_html_writer(self):
self.maxDiff = None
htdocs = 'testdata/htdocs'
args = types.SimpleNamespace()
setattr(args, 'arch', 'x86')
setattr(args, 'htdocs', htdocs)
setattr(args, 'rel_area', 'testdata/relarea')
setattr(args, 'dryrun', False)
setattr(args, 'force', True)
setattr(args, 'pkglist', 'testdata/pkglist/cygwin-pkg-maint')
packages = package.read_packages(args.rel_area, args.arch)
package.validate_packages(args, packages)
pkg2html.update_package_listings(args, packages, args.arch)
# compare the output files with expected
for (dirpath, subdirs, files) in os.walk(htdocs):
relpath = os.path.relpath(dirpath, htdocs)
for f in files:
results = os.path.join(htdocs, relpath, f)
expected = os.path.join('testdata/htdocs.expected', relpath, f)
if not filecmp.cmp(results, expected, shallow=False):
logging.info("%s different", os.path.join(relpath, f))
with open(results) as r, open(expected) as e:
self.assertMultiLineEqual(e.read(), r.read())
else:
logging.info("%s identical", os.path.join(relpath, f))
评论列表
文章目录