tests/test-doctest.py
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Mon, 23 Sep 2013 20:23:25 +0900
branchstable
changeset 19769 83d79a00cc24
parent 19098 f01ae031f84c
child 20047 10a7d2bcb81b
permissions -rw-r--r--
help: use full name of extensions to look up them for keyword search Before this patch, "hg help -k KEYWORD" fails, if there is the extension of which name includes ".", because "extensions.load()" invoked from "help.topicmatch()" fails to look such extension up, even though it is already loaded in. "help.topicmatch()" invokes "extensions.load()" with the name gotten from "extensions.enabled()". The former expects full name of extension (= key in '[extensions]' section), but the latter returns names shortened by "split('.')[-1]". This difference causes failure of looking extension up. This patch adds "shortname" argument to "extensions.enabled()" to make it return shortened names only if it is True. "help.topicmatch()" turns it off to get full name of extensions. Then, this patch shortens full name of extensions by "split('.')[-1]" for showing them in the list of extensions. Shortening is also applied on names gotten from "extensions.disabled()" but harmless, because it returns only extensions directly under "hgext" and their names should not include ".".
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
10413
e433002acb05 fix up a bunch of check-code warnings
Matt Mackall <mpm@selenic.com>
parents: 7185
diff changeset
     2
import os
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
15392
d7bfbc92a1c0 util: add a doctest for empty sha() calls
Matt Mackall <mpm@selenic.com>
parents: 14901
diff changeset
     7
import mercurial.util
d7bfbc92a1c0 util: add a doctest for empty sha() calls
Matt Mackall <mpm@selenic.com>
parents: 14901
diff changeset
     8
doctest.testmod(mercurial.util)
18288
0d5a22f73a1f posix: fix split() for the case where the path is at the root of the filesystem
Remy Blank <remy.blank@pobox.com>
parents: 16251
diff changeset
     9
# Only run doctests for the current platform
0d5a22f73a1f posix: fix split() for the case where the path is at the root of the filesystem
Remy Blank <remy.blank@pobox.com>
parents: 16251
diff changeset
    10
doctest.testmod(mercurial.util.platform)
15392
d7bfbc92a1c0 util: add a doctest for empty sha() calls
Matt Mackall <mpm@selenic.com>
parents: 14901
diff changeset
    11
3232
394ac87f3b74 [extendedchangelog] encode/decode function
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    12
import mercurial.changelog
394ac87f3b74 [extendedchangelog] encode/decode function
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    13
doctest.testmod(mercurial.changelog)
394ac87f3b74 [extendedchangelog] encode/decode function
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    14
11335
3201ff1459dd dagparser: parses and formats DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 10413
diff changeset
    15
import mercurial.dagparser
11337
0f3c8a47960e debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 11335
diff changeset
    16
doctest.testmod(mercurial.dagparser, optionflags=doctest.NORMALIZE_WHITESPACE)
11335
3201ff1459dd dagparser: parses and formats DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 10413
diff changeset
    17
12165
b7fbf24c8a93 match: add narrowmatcher class
Martin Geisler <mg@lazybytes.net>
parents: 11337
diff changeset
    18
import mercurial.match
b7fbf24c8a93 match: add narrowmatcher class
Martin Geisler <mg@lazybytes.net>
parents: 11337
diff changeset
    19
doctest.testmod(mercurial.match)
b7fbf24c8a93 match: add narrowmatcher class
Martin Geisler <mg@lazybytes.net>
parents: 11337
diff changeset
    20
13949
ba43aa1e173c store: add some doctests
Adrian Buehlmann <adrian@cadifra.com>
parents: 13402
diff changeset
    21
import mercurial.store
ba43aa1e173c store: add some doctests
Adrian Buehlmann <adrian@cadifra.com>
parents: 13402
diff changeset
    22
doctest.testmod(mercurial.store)
ba43aa1e173c store: add some doctests
Adrian Buehlmann <adrian@cadifra.com>
parents: 13402
diff changeset
    23
14171
fa2b596db182 ui: add configint function and tests
Sune Foldager <cryo@cyanite.org>
parents: 13949
diff changeset
    24
import mercurial.ui
fa2b596db182 ui: add configint function and tests
Sune Foldager <cryo@cyanite.org>
parents: 13949
diff changeset
    25
doctest.testmod(mercurial.ui)
fa2b596db182 ui: add configint function and tests
Sune Foldager <cryo@cyanite.org>
parents: 13949
diff changeset
    26
12594
bb324910e40a test-doctest: test the modules that contains doctests
Mads Kiilerich <mads@kiilerich.com>
parents: 11337
diff changeset
    27
import mercurial.url
bb324910e40a test-doctest: test the modules that contains doctests
Mads Kiilerich <mads@kiilerich.com>
parents: 11337
diff changeset
    28
doctest.testmod(mercurial.url)
bb324910e40a test-doctest: test the modules that contains doctests
Mads Kiilerich <mads@kiilerich.com>
parents: 11337
diff changeset
    29
19098
f01ae031f84c dispatch: add doctests for _earlygetopt
Bryan O'Sullivan <bryano@fb.com>
parents: 18288
diff changeset
    30
import mercurial.dispatch
f01ae031f84c dispatch: add doctests for _earlygetopt
Bryan O'Sullivan <bryano@fb.com>
parents: 18288
diff changeset
    31
doctest.testmod(mercurial.dispatch)
f01ae031f84c dispatch: add doctests for _earlygetopt
Bryan O'Sullivan <bryano@fb.com>
parents: 18288
diff changeset
    32
13046
7cc4263e07a9 encoding: add localstr class to track UTF-8 version of transcoded strings
Matt Mackall <mpm@selenic.com>
parents: 12595
diff changeset
    33
import mercurial.encoding
7cc4263e07a9 encoding: add localstr class to track UTF-8 version of transcoded strings
Matt Mackall <mpm@selenic.com>
parents: 12595
diff changeset
    34
doctest.testmod(mercurial.encoding)
12594
bb324910e40a test-doctest: test the modules that contains doctests
Mads Kiilerich <mads@kiilerich.com>
parents: 11337
diff changeset
    35
13402
f947d9a4c45c hgweb: doctest of url creation from wildcard expansion
Mads Kiilerich <mads@kiilerich.com>
parents: 13213
diff changeset
    36
import mercurial.hgweb.hgwebdir_mod
f947d9a4c45c hgweb: doctest of url creation from wildcard expansion
Mads Kiilerich <mads@kiilerich.com>
parents: 13213
diff changeset
    37
doctest.testmod(mercurial.hgweb.hgwebdir_mod)
f947d9a4c45c hgweb: doctest of url creation from wildcard expansion
Mads Kiilerich <mads@kiilerich.com>
parents: 13213
diff changeset
    38
7097
d4218edd55bd convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 7078
diff changeset
    39
import hgext.convert.cvsps
d4218edd55bd convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents: 7078
diff changeset
    40
doctest.testmod(hgext.convert.cvsps)
14901
a773119f30ba revset: add formatspec convenience query builder
Matt Mackall <mpm@selenic.com>
parents: 14171
diff changeset
    41
a773119f30ba revset: add formatspec convenience query builder
Matt Mackall <mpm@selenic.com>
parents: 14171
diff changeset
    42
import mercurial.revset
a773119f30ba revset: add formatspec convenience query builder
Matt Mackall <mpm@selenic.com>
parents: 14171
diff changeset
    43
doctest.testmod(mercurial.revset)
15393
87bb6b7644f6 minirst: use unicode string as intermediate form for replacement
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 15392
diff changeset
    44
87bb6b7644f6 minirst: use unicode string as intermediate form for replacement
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 15392
diff changeset
    45
import mercurial.minirst
87bb6b7644f6 minirst: use unicode string as intermediate form for replacement
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 15392
diff changeset
    46
doctest.testmod(mercurial.minirst)
16251
db68ee3289b6 templates/filters: add doctest to the 'person' filter
"Yann E. MORIN" <yann.morin.1998@free.fr>
parents: 15393
diff changeset
    47
db68ee3289b6 templates/filters: add doctest to the 'person' filter
"Yann E. MORIN" <yann.morin.1998@free.fr>
parents: 15393
diff changeset
    48
import mercurial.templatefilters
db68ee3289b6 templates/filters: add doctest to the 'person' filter
"Yann E. MORIN" <yann.morin.1998@free.fr>
parents: 15393
diff changeset
    49
doctest.testmod(mercurial.templatefilters)