Mercurial > hg
annotate tests/test-doctest.py @ 31971:73e9328e5307
obsolescence: add test case D-3 for obsolescence markers exchange
About 3 years ago, in August 2014, the logic to select what markers to select on
push was ported from the evolve extension to Mercurial core. However, for some
unclear reasons, the tests for that logic were not ported alongside.
I realised it a couple of weeks ago while working on another push related issue.
I've made a clean up pass on the tests and they are now ready to integrate the
core test suite. This series of changesets do not change any logic. I just adds
test for logic that has been around for about 10 versions of Mercurial.
They are a patch for each test case. It makes it easier to review and postpone
one with documentation issues without rejecting the wholes series.
This patch introduce case D3: missing prune target (prune not in "pushed set")
Each test case comes it in own test file. It help parallelism and does not
introduce a significant overhead from having a single unified giant test file.
Here are timing to support this claim.
# Multiple test files version:
# run-tests.py --local -j 1 test-exchange-*.t
53.40s user 6.82s system 85% cpu 1:10.76 total
52.79s user 6.97s system 85% cpu 1:09.97 total
52.94s user 6.82s system 85% cpu 1:09.69 total
# Single test file version:
# run-tests.py --local -j 1 test-exchange-obsmarkers.t
52.97s user 6.85s system 85% cpu 1:10.10 total
52.64s user 6.79s system 85% cpu 1:09.63 total
53.70s user 7.00s system 85% cpu 1:11.17 total
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Mon, 10 Apr 2017 16:54:43 +0200 |
parents | ca3b4a2b7e54 |
children | 05abc47f3746 |
rev | line source |
---|---|
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 |
28933
6262f0215d08
tests: make test-doctest use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27432
diff
changeset
|
2 |
6262f0215d08
tests: make test-doctest use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27432
diff
changeset
|
3 from __future__ import absolute_import |
6262f0215d08
tests: make test-doctest use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27432
diff
changeset
|
4 |
6262f0215d08
tests: make test-doctest use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27432
diff
changeset
|
5 import doctest |
6262f0215d08
tests: make test-doctest use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27432
diff
changeset
|
6 import os |
6262f0215d08
tests: make test-doctest use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
27432
diff
changeset
|
7 import sys |
31438
82350f7fa56c
tests: allow running doctests selectively on Python 3
Yuya Nishihara <yuya@tcha.org>
parents:
31024
diff
changeset
|
8 |
82350f7fa56c
tests: allow running doctests selectively on Python 3
Yuya Nishihara <yuya@tcha.org>
parents:
31024
diff
changeset
|
9 ispy3 = (sys.version_info[0] >= 3) |
82350f7fa56c
tests: allow running doctests selectively on Python 3
Yuya Nishihara <yuya@tcha.org>
parents:
31024
diff
changeset
|
10 |
7078
967adcf5910d
test-doctest: remove TERM env variable only if it's there
Patrick Mezard <pmezard@gmail.com>
parents:
7041
diff
changeset
|
11 if 'TERM' in os.environ: |
7184
380fda3eed13
clean up trailing spaces
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
7078
diff
changeset
|
12 del os.environ['TERM'] |
3232
394ac87f3b74
[extendedchangelog] encode/decode function
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
13 |
31438
82350f7fa56c
tests: allow running doctests selectively on Python 3
Yuya Nishihara <yuya@tcha.org>
parents:
31024
diff
changeset
|
14 # TODO: migrate doctests to py3 and enable them on both versions |
82350f7fa56c
tests: allow running doctests selectively on Python 3
Yuya Nishihara <yuya@tcha.org>
parents:
31024
diff
changeset
|
15 def testmod(name, optionflags=0, testtarget=None, py2=True, py3=False): |
82350f7fa56c
tests: allow running doctests selectively on Python 3
Yuya Nishihara <yuya@tcha.org>
parents:
31024
diff
changeset
|
16 if not (not ispy3 and py2 or ispy3 and py3): |
82350f7fa56c
tests: allow running doctests selectively on Python 3
Yuya Nishihara <yuya@tcha.org>
parents:
31024
diff
changeset
|
17 return |
20047
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
18 __import__(name) |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
19 mod = sys.modules[name] |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
20 if testtarget is not None: |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
21 mod = getattr(mod, testtarget) |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
22 doctest.testmod(mod, optionflags=optionflags) |
14171
fa2b596db182
ui: add configint function and tests
Sune Foldager <cryo@cyanite.org>
parents:
13949
diff
changeset
|
23 |
27432
77d25b913f80
changegroup: introduce cg3, which has support for exchanging treemanifests
Augie Fackler <augie@google.com>
parents:
25805
diff
changeset
|
24 testmod('mercurial.changegroup') |
20047
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
25 testmod('mercurial.changelog') |
31518
43d6ef658874
color: insert color code after every "\e[0m" (issue5413)
Yuya Nishihara <yuya@tcha.org>
parents:
31481
diff
changeset
|
26 testmod('mercurial.color') |
31481
a7c687c35119
ui: move configlist parser to config.py
Jun Wu <quark@fb.com>
parents:
31439
diff
changeset
|
27 testmod('mercurial.config') |
20047
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
28 testmod('mercurial.dagparser', optionflags=doctest.NORMALIZE_WHITESPACE) |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
29 testmod('mercurial.dispatch') |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
30 testmod('mercurial.encoding') |
30560
783016005122
formatter: add overview of API and example as doctest
Yuya Nishihara <yuya@tcha.org>
parents:
28933
diff
changeset
|
31 testmod('mercurial.formatter') |
20799
069bf1b821c8
clone: add doctest for default destination
Yuya Nishihara <yuya@tcha.org>
parents:
20419
diff
changeset
|
32 testmod('mercurial.hg') |
20047
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
33 testmod('mercurial.hgweb.hgwebdir_mod') |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
34 testmod('mercurial.match') |
31808
ca3b4a2b7e54
mdiff: add a hunkinrange helper function
Denis Laxalde <denis@laxalde.org>
parents:
31518
diff
changeset
|
35 testmod('mercurial.mdiff') |
20047
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
36 testmod('mercurial.minirst') |
24243
daee2039dd11
patch.pathtransform: add doctests
Siddharth Agarwal <sid0@fb.com>
parents:
22546
diff
changeset
|
37 testmod('mercurial.patch') |
21568
8dd17b19e722
subrepo: normalize path in the specific way for problematic encodings
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20840
diff
changeset
|
38 testmod('mercurial.pathutil') |
25306
c87b05925054
parser: add helper to reduce nesting of chained infix operations
Yuya Nishihara <yuya@tcha.org>
parents:
24243
diff
changeset
|
39 testmod('mercurial.parser') |
31439
b70407bd84d5
pycompat: add bytestr wrapper which mostly acts as a Python 2 str
Yuya Nishihara <yuya@tcha.org>
parents:
31438
diff
changeset
|
40 testmod('mercurial.pycompat', py3=True) |
31024
0b8356705de6
revset: split language services to revsetlang module (API)
Yuya Nishihara <yuya@tcha.org>
parents:
30881
diff
changeset
|
41 testmod('mercurial.revsetlang') |
30881
1be65deb3d54
smartset: move set classes and related functions from revset module (API)
Yuya Nishihara <yuya@tcha.org>
parents:
30560
diff
changeset
|
42 testmod('mercurial.smartset') |
20047
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
43 testmod('mercurial.store') |
20840
308344d80fe5
subrepo: factor out Git version check to add doctests
Siddharth Agarwal <sid0@fb.com>
parents:
20799
diff
changeset
|
44 testmod('mercurial.subrepo') |
20047
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
45 testmod('mercurial.templatefilters') |
25783
1f6878c87c25
templater: introduce one-pass parsing of nested template strings
Yuya Nishihara <yuya@tcha.org>
parents:
25306
diff
changeset
|
46 testmod('mercurial.templater') |
20047
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
47 testmod('mercurial.ui') |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
48 testmod('mercurial.url') |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
49 testmod('mercurial.util') |
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
50 testmod('mercurial.util', testtarget='platform') |
25805
584044e5ad57
convert: use 'default' for specifying branch name in branchmap (issue4753)
Eugene Baranov <eug.baranov@gmail.com>
parents:
25788
diff
changeset
|
51 testmod('hgext.convert.convcmd') |
20047
10a7d2bcb81b
tests: make doctest test runner less verbose
Mads Kiilerich <madski@unity3d.com>
parents:
19098
diff
changeset
|
52 testmod('hgext.convert.cvsps') |
20048
da99ebd35f00
convert: readability and test of rpairs function
Mads Kiilerich <madski@unity3d.com>
parents:
20047
diff
changeset
|
53 testmod('hgext.convert.filemap') |
25788
a36fd0993522
convert: unescape Perforce-escaped special characters in filenames
Eugene Baranov <eug.baranov@gmail.com>
parents:
25783
diff
changeset
|
54 testmod('hgext.convert.p4') |
20419
e61a8395c3c1
convert: make subversion revsplit more stable when meeting revisions without @
Mads Kiilerich <madski@unity3d.com>
parents:
20048
diff
changeset
|
55 testmod('hgext.convert.subversion') |
22546
aac5482db318
mq: refactor patchheader header ordering to match export (BC)
Mads Kiilerich <madski@unity3d.com>
parents:
21568
diff
changeset
|
56 testmod('hgext.mq') |