1
execfile('functional/tests/_standalone_rst_defaults.py')
3
# Source and destination file names:
4
test_source = 'standalone_rst_s5_html.txt'
5
test_destination = 'standalone_rst_s5_html_1.html'
7
# Keyword parameters passed to publish_file:
8
writer_name = 's5_html'
11
settings_overrides['theme'] = 'small-black'
14
# Extra functional tests.
15
# Prefix all names with '_' to avoid confusing `docutils.core.publish_file`.
17
import filecmp as _filecmp
19
def _test_more(expected_dir, output_dir, test_case, parameters):
20
"""Compare ``ui/<theme>`` directories."""
21
theme = settings_overrides.get('theme', 'default')
22
expected = '%s/%s/%s' % (expected_dir, 'ui', theme)
23
output = '%s/%s/%s' % (output_dir, 'ui', theme)
24
differences, uniques = _compare_directories(expected, output)
27
parts.append('The following files differ from the expected output:')
28
parts.extend(differences)
29
expected = [path.replace('functional/output/', 'functional/expected/')
30
for path in differences]
31
parts.append('Please compare the expected and actual output files:')
32
parts.extend([' diff %s %s' % tup
33
for tup in zip(expected, differences)])
34
parts.append('If the actual output is correct, please replace the '
35
'expected output files:')
36
parts.extend([' mv %s %s' % tup
37
for tup in zip(differences, expected)])
38
parts.append('and check them in to Subversion:')
39
parts.extend([' svn commit -m "<comment>" %s' % path
40
for path in expected])
42
parts.append('The following paths are unique:')
44
test_case.assert_(not parts, '\n'.join(parts))
46
def _compare_directories(expected, output):
47
dircmp = _filecmp.dircmp(expected, output, ['.svn', 'CVS'])
48
differences = ['%s/%s' % (output, name) for name in dircmp.diff_files]
49
uniques = (['%s/%s' % (expected, name) for name in dircmp.left_only]
50
+ ['%s/%s' % (output, name) for name in dircmp.right_only])
51
for subdir in dircmp.common_dirs:
52
diffs, uniqs = _compare_directories('%s/%s' % (expected, subdir),
53
'%s/%s' % (output, subdir))
54
differences.extend(diffs)
56
return differences, uniques