standalone_rst_s5_html_1.py :  » Development » Docutils » docutils » test » functional » tests » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Development » Docutils 
Docutils » docutils » test » functional » tests » standalone_rst_s5_html_1.py
exec(open('functional/tests/_standalone_rst_defaults.py').read())

# Source and destination file names:
test_source = 'standalone_rst_s5_html.txt'
test_destination = 'standalone_rst_s5_html_1.html'

# Keyword parameters passed to publish_file:
writer_name = 's5_html'

# Settings:
settings_overrides['theme'] = 'small-black'


# Extra functional tests.
# Prefix all names with '_' to avoid confusing `docutils.core.publish_file`.

import filecmp as _filecmp

def _test_more(expected_dir, output_dir, test_case, parameters):
    """Compare ``ui/<theme>`` directories."""
    theme = settings_overrides.get('theme', 'default')
    expected = '%s/%s/%s' % (expected_dir, 'ui', theme)
    output = '%s/%s/%s' % (output_dir, 'ui', theme)
    differences, uniques = _compare_directories(expected, output)
    parts = []
    if differences:
        parts.append('The following files differ from the expected output:')
        parts.extend(differences)
        expected = [path.replace('functional/output/', 'functional/expected/')
                    for path in differences]
        parts.append('Please compare the expected and actual output files:')
        parts.extend(['  diff %s %s' % tup
                      for tup in zip(expected, differences)])
        parts.append('If the actual output is correct, please replace the '
                     'expected output files:')
        parts.extend(['  mv %s %s' % tup
                      for tup in zip(differences, expected)])
        parts.append('and check them in to Subversion:')
        parts.extend(['  svn commit -m "<comment>" %s' % path
                      for path in expected])
    if uniques:
        parts.append('The following paths are unique:')
        parts.extend(uniques)
    test_case.assert_(not parts, '\n'.join(parts))

def _compare_directories(expected, output):
    dircmp = _filecmp.dircmp(expected, output, ['.svn', 'CVS'])
    differences = ['%s/%s' % (output, name) for name in dircmp.diff_files]
    uniques = (['%s/%s' % (expected, name) for name in dircmp.left_only]
               + ['%s/%s' % (output, name) for name in dircmp.right_only])
    for subdir in dircmp.common_dirs:
        diffs, uniqs = _compare_directories('%s/%s' % (expected, subdir),
                                            '%s/%s' % (output, subdir))
        differences.extend(diffs)
        uniques.extend(uniqs)
    return differences, uniques
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.