##// END OF EJS Templates
interfaces: convert `repository.irevisiondelta` from zope `Attribute` attrs...
interfaces: convert `repository.irevisiondelta` from zope `Attribute` attrs This is the same transformation as b455dfddfed0 did for dirstate.

File last commit:

r53331:c21c9ec3 default
r53366:2aada52e default
Show More
common-pattern.py
228 lines | 7.8 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
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
Augie Fackler
formatting: blacken the codebase...
r43346 (br'(zstd,)?zlib,none,bzip2', br'$USUAL_COMPRESSIONS$'),
(br'=(zstd,)?zlib', br'=$BUNDLE2_COMPRESSIONS$'),
Boris Feld
test-pattern: register current the bundlecaps string...
r35070 # capabilities sent through http
Augie Fackler
formatting: blacken the codebase...
r43346 (
br'bundlecaps=HG20%2Cbundle2%3DHG20%250A'
br'bookmarks%250A'
Matt Harbison
configitems: enable changegroup3 by default (unless using infinitepush)...
r51176 br'changegroup%253D01%252C02%252C03%250A'
Valentin Gatien-Baron
exchange: turn on option that makes concurrent pushes work better...
r44896 br'checkheads%253Drelated%250A'
Augie Fackler
formatting: blacken the codebase...
r43346 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%250A'
br'stream%253Dv2',
# (the replacement patterns)
br'$USUAL_BUNDLE_CAPS$',
Boris Feld
test-pattern: register current the bundlecaps string...
r35070 ),
Augie Fackler
formatting: blacken the codebase...
r43346 (
br'bundlecaps=HG20%2Cbundle2%3DHG20%250A'
br'bookmarks%250A'
Matt Harbison
configitems: enable changegroup3 by default (unless using infinitepush)...
r51176 br'changegroup%253D01%252C02%252C03%250A'
Valentin Gatien-Baron
exchange: turn on option that makes concurrent pushes work better...
r44896 br'checkheads%3Drelated%0A'
Augie Fackler
formatting: blacken the codebase...
r43346 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
Augie Fackler
formatting: blacken the codebase...
r43346 (
br'bundle2=HG20%0A'
br'bookmarks%0A'
Matt Harbison
configitems: enable changegroup3 by default (unless using infinitepush)...
r51176 br'changegroup%3D01%2C02%2C03%0A'
Valentin Gatien-Baron
exchange: turn on option that makes concurrent pushes work better...
r44896 br'checkheads%3Drelated%0A'
Augie Fackler
formatting: blacken the codebase...
r43346 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'
br'remote-changegroup%3Dhttp%2Chttps%0A'
br'stream%3Dv2',
# (replacement patterns)
br'$USUAL_BUNDLE2_CAPS$',
Gregory Szorc
bundle2: always advertise client support for stream parts...
r35810 ),
# bundle2 capabilities advertised by the server
Joerg Sonnenberger
tests: refactor common bundle2 capabilities...
r38751 (
Augie Fackler
formatting: blacken the codebase...
r43346 br'bundle2=HG20%0A'
br'bookmarks%0A'
Matt Harbison
configitems: enable changegroup3 by default (unless using infinitepush)...
r51176 br'changegroup%3D01%2C02%2C03%0A'
Valentin Gatien-Baron
exchange: turn on option that makes concurrent pushes work better...
r44896 br'checkheads%3Drelated%0A'
Augie Fackler
formatting: blacken the codebase...
r43346 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'
Joerg Sonnenberger
exchange: stop advertising rev-branch-cache bundle capability...
r47378 br'remote-changegroup%3Dhttp%2Chttps',
Augie Fackler
formatting: blacken the codebase...
r43346 # (replacement patterns)
br'$USUAL_BUNDLE2_CAPS_SERVER$',
),
(
br'bundle2=HG20%0A'
br'bookmarks%0A'
Matt Harbison
configitems: enable changegroup3 by default (unless using infinitepush)...
r51176 br'changegroup%3D01%2C02%2C03%0A'
Augie Fackler
formatting: blacken the codebase...
r43346 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'
br'stream%3Dv2',
# (replacement patterns)
br'$USUAL_BUNDLE2_CAPS_NO_PHASES$',
Joerg Sonnenberger
tests: refactor common bundle2 capabilities...
r38751 ),
Matt Harbison
tests: add a substitution pattern for HTTP error log dates...
r37495 # HTTP access log dates
Augie Fackler
formatting: blacken the codebase...
r43346 (
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
Augie Fackler
formatting: blacken the codebase...
r43346 (
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 HTTP error log dates...
r37495 ),
Matt Harbison
tests: add a substitution pattern for dates in HTTP headers and LFS payload...
r36942 # HTTP header dates- RFC 1123
Augie Fackler
formatting: blacken the codebase...
r43346 (
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
Augie Fackler
formatting: blacken the codebase...
r43346 (
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: add a substitution pattern for dates in HTTP headers and LFS payload...
r36942 ),
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)
Augie Fackler
formatting: blacken the codebase...
r43346 (
br'(.*file:/)/?(/\$TESTTMP.*)',
lambda m: m.group(1) + b'*' + m.group(2) + b' (glob)',
Matt Harbison
tests: convert the 'file://\$TESTTMP' rule to an automatic substitution...
r35462 ),
tests: automatically glob the discovery timing information...
r51290 # `discovery debug output
(
br'\b(\d+) total queries in \d.\d\d\d\ds\b',
lambda m: (br'%s total queries in *.????s (glob)' % m.group(1)),
),
common-pattern: cover "elapsed time" line...
r52174 (
br'\belapsed time: \d+.\d{6} seconds\b',
br'elapsed time: *.?????? seconds (glob)',
),
test-sparse-revlog: add common-pattern rule for the timing...
r53331 # delta find debug time
(
br'(DBG-DELTAS: .* - )duration=\d+\.\d{6}\b',
lambda m: br'%sduration=*.?????? (glob)' % m.group(1),
),
(
br'DBG-DELTAS-SEARCH: delta-search-time=\d+.\d{6}',
br'DBG-DELTAS-SEARCH: delta-search-time=* (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$': (
Raphaël Gomès
rust-filepatterns: call new Rust implementations from Python...
r42516 # IOError in Python does not have the same error message
# than in Rust, and automatic conversion is not possible
# because of module member privacy.
br'No such file or directory \(os error 2\)',
Matt Harbison
tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages...
r35230 # strerror()
br'No such file or directory',
# FormatMessage(ERROR_FILE_NOT_FOUND)
br'The system cannot find the file specified',
),
Arseniy Alekseyev
tests: add a rewriting step to detect EACCES errors
r51215 br'$EACCES$': (
br'Permission denied \(os error 13\)',
# strerror
br'Permission denied',
),
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',
av6
tests: add another variation of EADDRNOTAVAIL message (e.g. from NetBSD)
r50419 br'Can\'t assign requested address',
Boris Feld
tests: update network related errors for Debian 9...
r40917 # FormatMessage(WSAEADDRNOTAVAIL)
Matt Harbison
tests: fill in the Windows pattern for `$EADDRNOTAVAIL$` matching...
r52042 br'The requested address is not valid in its context',
Augie Fackler
formatting: blacken the codebase...
r43346 ),
Matt Harbison
tests: use pattern matching to mask `ECONNREFUSED` messages...
r52835 br'$ECONNREFUSED$': (
# strerror()
br'Connection refused',
# FormatMessage(WSAECONNREFUSED)
br'No connection could be made because the target machine actively refused it',
),
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':
Augie Fackler
formatting: blacken the codebase...
r43346 substitutions.extend(
[
(s, lambda match: match.group().replace(b'\\', b'/'))
for s in _winpathfixes
]
)