##// END OF EJS Templates
rust-filepatterns: add `rust-cpython` bindings for `filepatterns`...
rust-filepatterns: add `rust-cpython` bindings for `filepatterns` This change adds the `rust-cpython` interface for top-level functions and exceptions in the filepatterns module. Contrary to the Python implementation, this tries to have finer-grained exceptions to allow for better readability and flow control down the line. Differential Revision: https://phab.mercurial-scm.org/D6272

File last commit:

r40917:8695fbe1 default
r42515:94f3a73b default
Show More
common-pattern.py
200 lines | 6.3 KiB | text/x-python | PythonLexer
/ tests / common-pattern.py
Boris Feld
test-pattern: substitute common compression list...
r35069 # common patterns in test at can safely be replaced
from __future__ import absolute_import
Matt Harbison
run-tests: add substitution patterns for common '\' path output on Windows...
r35465 import os
Boris Feld
test-pattern: substitute common compression list...
r35069 substitutions = [
# list of possible compressions
Boris Feld
test: fix common-pattern for pure variant...
r35234 (br'(zstd,)?zlib,none,bzip2',
Boris Feld
test-pattern: substitute common compression list...
r35069 br'$USUAL_COMPRESSIONS$'
),
Augie Fackler
tests: add a pattern to fix --pure tests...
r35824 (br'=(zstd,)?zlib',
br'=$BUNDLE2_COMPRESSIONS$'
),
Boris Feld
test-pattern: register current the bundlecaps string...
r35070 # capabilities sent through http
(br'bundlecaps=HG20%2Cbundle2%3DHG20%250A'
Boris Feld
push: include a 'check:bookmarks' part when possible...
r35260 br'bookmarks%250A'
Boris Feld
test-pattern: register current the bundlecaps string...
r35070 br'changegroup%253D01%252C02%250A'
br'digests%253Dmd5%252Csha1%252Csha512%250A'
br'error%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250A'
br'hgtagsfnodes%250A'
br'listkeys%250A'
br'phases%253Dheads%250A'
br'pushkey%250A'
Gregory Szorc
bundle2: always advertise client support for stream parts...
r35810 br'remote-changegroup%253Dhttp%252Chttps%250A'
Boris Feld
revbranchcache: advertise and use 'rbc' exchange capability...
r36986 br'rev-branch-cache%250A'
Gregory Szorc
bundle2: always advertise client support for stream parts...
r35810 br'stream%253Dv2',
Boris Feld
test-pattern: register current the bundlecaps string...
r35070 # (the replacement patterns)
br'$USUAL_BUNDLE_CAPS$'
),
Gregory Szorc
bundle2: always advertise client support for stream parts...
r35810 (br'bundlecaps=HG20%2Cbundle2%3DHG20%250A'
br'bookmarks%250A'
br'changegroup%253D01%252C02%250A'
br'digests%253Dmd5%252Csha1%252Csha512%250A'
br'error%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250A'
br'hgtagsfnodes%250A'
br'listkeys%250A'
br'phases%253Dheads%250A'
br'pushkey%250A'
br'remote-changegroup%253Dhttp%252Chttps',
# (the replacement patterns)
br'$USUAL_BUNDLE_CAPS_SERVER$'
),
Boris Feld
test-pattern: register the current the bundle2 capabilities string...
r35071 # bundle2 capabilities sent through ssh
(br'bundle2=HG20%0A'
Boris Feld
push: include a 'check:bookmarks' part when possible...
r35260 br'bookmarks%0A'
Boris Feld
test-pattern: register the current the bundle2 capabilities string...
r35071 br'changegroup%3D01%2C02%0A'
br'digests%3Dmd5%2Csha1%2Csha512%0A'
br'error%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A'
br'hgtagsfnodes%0A'
br'listkeys%0A'
br'phases%3Dheads%0A'
br'pushkey%0A'
Gregory Szorc
bundle2: always advertise client support for stream parts...
r35810 br'remote-changegroup%3Dhttp%2Chttps%0A'
Boris Feld
revbranchcache: advertise and use 'rbc' exchange capability...
r36986 br'rev-branch-cache%0A'
Gregory Szorc
bundle2: always advertise client support for stream parts...
r35810 br'stream%3Dv2',
# (replacement patterns)
br'$USUAL_BUNDLE2_CAPS$'
),
# bundle2 capabilities advertised by the server
(br'bundle2=HG20%0A'
br'bookmarks%0A'
br'changegroup%3D01%2C02%0A'
br'digests%3Dmd5%2Csha1%2Csha512%0A'
br'error%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A'
br'hgtagsfnodes%0A'
br'listkeys%0A'
br'phases%3Dheads%0A'
br'pushkey%0A'
Boris Feld
revbranchcache: advertise and use 'rbc' exchange capability...
r36986 br'remote-changegroup%3Dhttp%2Chttps%0A'
br'rev-branch-cache',
Boris Feld
test-pattern: register the current the bundle2 capabilities string...
r35071 # (replacement patterns)
Gregory Szorc
bundle2: always advertise client support for stream parts...
r35810 br'$USUAL_BUNDLE2_CAPS_SERVER$'
),
Joerg Sonnenberger
tests: refactor common bundle2 capabilities...
r38751 (
br'bundle2=HG20%0A'
br'bookmarks%0A'
br'changegroup%3D01%2C02%0A'
br'digests%3Dmd5%2Csha1%2Csha512%0A'
br'error%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A'
br'hgtagsfnodes%0A'
br'listkeys%0A'
br'pushkey%0A'
br'remote-changegroup%3Dhttp%2Chttps%0A'
av6
bundle2: make server.bundle2.stream default to True...
r39758 br'rev-branch-cache%0A'
br'stream%3Dv2',
Joerg Sonnenberger
tests: refactor common bundle2 capabilities...
r38751 # (replacement patterns)
br'$USUAL_BUNDLE2_CAPS_NO_PHASES$'
),
Matt Harbison
tests: add a substitution pattern for HTTP error log dates...
r37495 # HTTP access log dates
Matt Harbison
tests: add HTTP POST and PUT support to the $LOGDATE$ substitution...
r36403 (br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] "(GET|PUT|POST)',
lambda m: br' - - [$LOGDATE$] "' + m.group(1)
Boris Feld
test-pattern: substitute the HTTP log timestamp too...
r35072 ),
Matt Harbison
tests: add a substitution pattern for HTTP error log dates...
r37495 # HTTP error log dates
(br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] (HG error:|Exception)',
lambda m: br' - - [$ERRDATE$] ' + m.group(1)
),
Matt Harbison
tests: add a substitution pattern for dates in HTTP headers and LFS payload...
r36942 # HTTP header dates- RFC 1123
Gregory Szorc
tests: use $HTTP_DATE$ for Date header...
r37026 (br'([Dd]ate): [A-Za-z]{3}, \d\d [A-Za-z]{3} \d{4} \d\d:\d\d:\d\d GMT',
lambda m: br'%s: $HTTP_DATE$' % m.group(1)
Matt Harbison
tests: add a substitution pattern for dates in HTTP headers and LFS payload...
r36942 ),
# LFS expiration value
(br'"expires_at": "\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ"',
br'"expires_at": "$ISO_8601_DATE_TIME$"'
),
Matt Harbison
tests: convert the 'file://\$TESTTMP' rule to an automatic substitution...
r35462 # Windows has an extra '/' in the following lines that get globbed away:
# pushing to file:/*/$TESTTMP/r2 (glob)
# comparing with file:/*/$TESTTMP/r2 (glob)
# sub/maybelarge.dat: largefile 34..9c not available from
# file:/*/$TESTTMP/largefiles-repo (glob)
(br'(.*file:/)/?(/\$TESTTMP.*)',
lambda m: m.group(1) + b'*' + m.group(2) + b' (glob)'
),
Boris Feld
test-pattern: substitute common compression list...
r35069 ]
Matt Harbison
tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages...
r35230
# Various platform error strings, keyed on a common replacement string
_errors = {
br'$ENOENT$': (
# strerror()
br'No such file or directory',
# FormatMessage(ERROR_FILE_NOT_FOUND)
br'The system cannot find the file specified',
),
Matt Harbison
tests: add a substitution for ENOTDIR/ERROR_PATH_NOT_FOUND messages
r35231 br'$ENOTDIR$': (
# strerror()
br'Not a directory',
# FormatMessage(ERROR_PATH_NOT_FOUND)
br'The system cannot find the path specified',
),
Matt Harbison
tests: add a substitution for ECONNRESET/WSAECONNRESET messages
r35232 br'$ECONNRESET$': (
# strerror()
br'Connection reset by peer',
# FormatMessage(WSAECONNRESET)
br'An existing connection was forcibly closed by the remote host',
),
Matt Harbison
tests: add a substitution for EADDRINUSE/WSAEADDRINUSE messages...
r35233 br'$EADDRINUSE$': (
# strerror()
br'Address already in use',
# FormatMessage(WSAEADDRINUSE)
br'Only one usage of each socket address'
br' \(protocol/network address/port\) is normally permitted',
),
Boris Feld
tests: update network related errors for Debian 9...
r40917 br'$EADDRNOTAVAIL$': (
# strerror()
br'Cannot assign requested address',
# FormatMessage(WSAEADDRNOTAVAIL)
)
Matt Harbison
tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages...
r35230 }
for replace, msgs in _errors.items():
substitutions.extend((m, replace) for m in msgs)
Matt Harbison
run-tests: add substitution patterns for common '\' path output on Windows...
r35465
# Output lines on Windows that can be autocorrected for '\' vs '/' path
# differences.
_winpathfixes = [
# cloning subrepo s\ss from $TESTTMP/t/s/ss
# cloning subrepo foo\bar from http://localhost:$HGPORT/foo/bar
br'(?m)^cloning subrepo \S+\\.*',
# pulling from $TESTTMP\issue1852a
br'(?m)^pulling from \$TESTTMP\\.*',
# pushing to $TESTTMP\a
br'(?m)^pushing to \$TESTTMP\\.*',
# pushing subrepo s\ss to $TESTTMP/t/s/ss
br'(?m)^pushing subrepo \S+\\\S+ to.*',
# moving d1\d11\a1 to d3/d11/a1
br'(?m)^moving \S+\\.*',
# d1\a: not recording move - dummy does not exist
br'\S+\\\S+: not recording move .+',
# reverting s\a
br'(?m)^reverting (?!subrepo ).*\\.*',
# saved backup bundle to
# $TESTTMP\test\.hg\strip-backup/443431ffac4f-2fc5398a-backup.hg
br'(?m)^saved backup bundle to \$TESTTMP.*\.hg',
# no changes made to subrepo s\ss since last push to ../tcc/s/ss
br'(?m)^no changes made to subrepo \S+\\\S+ since.*',
# changeset 5:9cc5aa7204f0: stuff/maybelarge.dat references missing
# $TESTTMP\largefiles-repo-hg\.hg\largefiles\76..38
br'(?m)^changeset .* references (corrupted|missing) \$TESTTMP\\.*',
# stuff/maybelarge.dat: largefile 76..38 not available from
# file:/*/$TESTTMP\largefiles-repo (glob)
br'.*: largefile \S+ not available from file:/\*/.+',
]
if os.name == 'nt':
substitutions.extend([(s, lambda match: match.group().replace(b'\\', b'/'))
for s in _winpathfixes])