Mercurial > public > mercurial-scm > hg-stable
comparison tests/common-pattern.py @ 35453:24528dba0e64
run-tests: add substitution patterns for common '\' path output on Windows
The goal is to reduce the amount of hand tuning of new/changed tests that is
required on Windows. Since the OS prints the proper paths everywhere else, this
is limited to Windows. These are based on the check-code rules that were
dropped in 5feb782c7a95.
There are some minor tweaks, because those were trying to detect '/' paths
without a '(glob)' at the end, whereas these detect '\' paths. Also, it looks
like the 'no changes made to subrepo' one was broke, because the path to the
subrepo has been getting output but was not in the pattern. End anchors are
dropped because '(glob)' is no longer required, but '(feature !)' annotations
are a possibility.
The 'saved backup bundle' pattern dropped from run-tests.py was simply carrying
over the first capture group. The replace() method runs prior to evaluating
'\1', but it wasn't doing anything because of the 'r' prefix on '\\'.
The 'not recording move' entry is new, because I stumbled upon it searching for
some of these patterns. There are probably others.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 12 Dec 2017 20:11:13 -0500 |
parents | 991e4404e910 |
children | 1d118f9f4f57 |
comparison
equal
deleted
inserted
replaced
35452:8251c4c4abdc | 35453:24528dba0e64 |
---|---|
1 # common patterns in test at can safely be replaced | 1 # common patterns in test at can safely be replaced |
2 from __future__ import absolute_import | 2 from __future__ import absolute_import |
3 | |
4 import os | |
3 | 5 |
4 substitutions = [ | 6 substitutions = [ |
5 # list of possible compressions | 7 # list of possible compressions |
6 (br'(zstd,)?zlib,none,bzip2', | 8 (br'(zstd,)?zlib,none,bzip2', |
7 br'$USUAL_COMPRESSIONS$' | 9 br'$USUAL_COMPRESSIONS$' |
81 ), | 83 ), |
82 } | 84 } |
83 | 85 |
84 for replace, msgs in _errors.items(): | 86 for replace, msgs in _errors.items(): |
85 substitutions.extend((m, replace) for m in msgs) | 87 substitutions.extend((m, replace) for m in msgs) |
88 | |
89 # Output lines on Windows that can be autocorrected for '\' vs '/' path | |
90 # differences. | |
91 _winpathfixes = [ | |
92 # cloning subrepo s\ss from $TESTTMP/t/s/ss | |
93 # cloning subrepo foo\bar from http://localhost:$HGPORT/foo/bar | |
94 br'(?m)^cloning subrepo \S+\\.*', | |
95 | |
96 # pulling from $TESTTMP\issue1852a | |
97 br'(?m)^pulling from \$TESTTMP\\.*', | |
98 | |
99 # pushing to $TESTTMP\a | |
100 br'(?m)^pushing to \$TESTTMP\\.*', | |
101 | |
102 # pushing subrepo s\ss to $TESTTMP/t/s/ss | |
103 br'(?m)^pushing subrepo \S+\\\S+ to.*', | |
104 | |
105 # moving d1\d11\a1 to d3/d11/a1 | |
106 br'(?m)^moving \S+\\.*', | |
107 | |
108 # d1\a: not recording move - dummy does not exist | |
109 br'\S+\\\S+: not recording move .+', | |
110 | |
111 # reverting s\a | |
112 br'(?m)^reverting (?!subrepo ).*\\.*', | |
113 | |
114 # saved backup bundle to | |
115 # $TESTTMP\test\.hg\strip-backup/443431ffac4f-2fc5398a-backup.hg | |
116 br'(?m)^saved backup bundle to \$TESTTMP.*\.hg', | |
117 | |
118 # no changes made to subrepo s\ss since last push to ../tcc/s/ss | |
119 br'(?m)^no changes made to subrepo \S+\\\S+ since.*', | |
120 | |
121 # changeset 5:9cc5aa7204f0: stuff/maybelarge.dat references missing | |
122 # $TESTTMP\largefiles-repo-hg\.hg\largefiles\76..38 | |
123 br'(?m)^changeset .* references (corrupted|missing) \$TESTTMP\\.*', | |
124 | |
125 # stuff/maybelarge.dat: largefile 76..38 not available from | |
126 # file:/*/$TESTTMP\largefiles-repo (glob) | |
127 br'.*: largefile \S+ not available from file:/\*/.+', | |
128 ] | |
129 | |
130 if os.name == 'nt': | |
131 substitutions.extend([(s, lambda match: match.group().replace(b'\\', b'/')) | |
132 for s in _winpathfixes]) |