tests/test-doctest.py
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Tue, 11 Mar 2014 14:36:40 +0900
changeset 20689 401f9b661a2d
parent 20419 e61a8395c3c1
child 20799 069bf1b821c8
permissions -rw-r--r--
doc: show short description of each commands in generated documents Before this patch, short description of each commands is not shown in generated documents (HTML file and UNIX man page). This omitting may prevent users from understanding about commands. This patch show it as the 1st paragraph in the help section of each commands. This style is chosen because: - showing it as the section title in "command - short desc" style disallows referencing by "#command" in HTML file: in "en" locale, hyphen concatenated title is used as the section ID in HTML file for this style - showing it as the 1st paragraph in "command - short desc" style seems to be redundant: "command" appears also just before as the section title - showing it just after synopsis like "hg help command" seems not to be reasonable in UNIX man page This patch just writes short description ("d['desc'][0]") before "::", because it should be already "strip()"-ed in "get_desc()", or empty string for the command without description.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7041
b856071435f7 tests: fix readline escape characters in output for test-doctest.py
Mads Kiilerich <mads@kiilerich.com>
parents: 5525
diff changeset
     1
# this is hack to make sure no escape characters are inserted into the output
20047
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
     2
import os, sys
7078
967adcf5910d test-doctest: remove TERM env variable only if it's there
Patrick Mezard <pmezard@gmail.com>
parents: 7041
diff changeset
     3
if 'TERM' in os.environ:
7184
380fda3eed13 clean up trailing spaces
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7078
diff changeset
     4
    del os.environ['TERM']
3232
394ac87f3b74 [extendedchangelog] encode/decode function
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     5
import doctest
394ac87f3b74 [extendedchangelog] encode/decode function
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     6
20047
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
     7
def testmod(name, optionflags=0, testtarget=None):
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
     8
    __import__(name)
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
     9
    mod = sys.modules[name]
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
    10
    if testtarget is not None:
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
    11
        mod = getattr(mod, testtarget)
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
    12
    doctest.testmod(mod, optionflags=optionflags)
14171
fa2b596db182 ui: add configint function and tests
Sune Foldager <cryo@cyanite.org>
parents: 13949
diff changeset
    13
20047
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
    14
testmod('mercurial.changelog')
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
    15
testmod('mercurial.dagparser', optionflags=doctest.NORMALIZE_WHITESPACE)
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
    16
testmod('mercurial.dispatch')
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
    17
testmod('mercurial.encoding')
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
    18
testmod('mercurial.hgweb.hgwebdir_mod')
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
    19
testmod('mercurial.match')
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
    20
testmod('mercurial.minirst')
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
    21
testmod('mercurial.revset')
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
    22
testmod('mercurial.store')
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
    23
testmod('mercurial.templatefilters')
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
    24
testmod('mercurial.ui')
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
    25
testmod('mercurial.url')
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
    26
testmod('mercurial.util')
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
    27
testmod('mercurial.util', testtarget='platform')
10a7d2bcb81b tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents: 19098
diff changeset
    28
testmod('hgext.convert.cvsps')
20048
da99ebd35f00 convert: readability and test of rpairs function
Mads Kiilerich <madski@unity3d.com>
parents: 20047
diff changeset
    29
testmod('hgext.convert.filemap')
20419
e61a8395c3c1 convert: make subversion revsplit more stable when meeting revisions without @
Mads Kiilerich <madski@unity3d.com>
parents: 20048
diff changeset
    30
testmod('hgext.convert.subversion')