##// END OF EJS Templates
rebase: choose default destination the same way as 'hg merge' (BC)...
rebase: choose default destination the same way as 'hg merge' (BC) This changeset finally make 'hg rebase' choose its default destination using the same logic as 'hg merge'. The previous default was "tipmost changeset on the current branch", the new default is "the other head if there is only one". This change has multiple consequences: - Multiple tests which were not rebasing anything (rebasing from tipmost head) are now rebasing on the other "lower" branch. This is the expected new behavior. - A test is now explicitly aborting when there is too many heads on the branch. This is the expected behavior. - We gained a better detection of the "nothing to rebase" case while performing 'hg pull --rebase' so the message have been updated. Making clearer than an update was performed and why. This is beneficial side-effect. - Rebasing from an active bookmark will behave the same as 'hg merge' from a bookmark.

File last commit:

r25061:625dd917 default
r28189:fac3a24b default
Show More
test-run-tests.py
98 lines | 2.5 KiB | text/x-python | PythonLexer
/ tests / test-run-tests.py
Simon Heimberg
tests: new test for line matching functions in run-tests...
r20271 """test line matching with some failing examples and some which warn
run-test.t only checks positive matches and can not see warnings
(both by design)
"""
Augie Fackler
test-run-tests: fix for Python 3.5...
r25061 from __future__ import print_function
Simon Heimberg
tests: new test for line matching functions in run-tests...
r20271
Simon Heimberg
tests: fix test-run-tests.py on OS X...
r20284 import os, re
# this is hack to make sure no escape characters are inserted into the output
if 'TERM' in os.environ:
del os.environ['TERM']
import doctest
Simon Heimberg
tests: new test for line matching functions in run-tests...
r20271 run_tests = __import__('run-tests')
Augie Fackler
test-run-tests: fix for Python 3.5...
r25061 def prn(ex):
m = ex.args[0]
if isinstance(m, str):
print(m)
else:
print(m.decode('utf-8'))
Simon Heimberg
tests: new test for line matching functions in run-tests...
r20271 def lm(expected, output):
r"""check if output matches expected
does it generally work?
Augie Fackler
test-run-tests: fix for Python 3.5...
r25061 >>> lm(b'H*e (glob)\n', b'Here\n')
Simon Heimberg
tests: new test for line matching functions in run-tests...
r20271 True
fail on bad test data
Augie Fackler
test-run-tests: fix for Python 3.5...
r25061 >>> try: lm(b'a\n',b'a')
... except AssertionError as ex: print(ex)
Simon Heimberg
tests: new test for line matching functions in run-tests...
r20271 missing newline
Augie Fackler
test-run-tests: fix for Python 3.5...
r25061 >>> try: lm(b'single backslash\n', b'single \backslash\n')
... except AssertionError as ex: prn(ex)
Simon Heimberg
tests: new test for line matching functions in run-tests...
r20271 single backslash or unknown char
"""
Augie Fackler
test-run-tests: fix for Python 3.5...
r25061 assert (expected.endswith(b'\n')
and output.endswith(b'\n')), 'missing newline'
assert not re.search(br'[^ \w\\/\r\n()*?]', expected + output), \
b'single backslash or unknown char'
Gregory Szorc
run-tests: make linematch a static method of TTest...
r21315 match = run_tests.TTest.linematch(expected, output)
Simon Heimberg
run-tests: suggest to append glob when only path sep does not match...
r20273 if isinstance(match, str):
return 'special: ' + match
Augie Fackler
test-run-tests: fix for Python 3.5...
r25061 elif isinstance(match, bytes):
return 'special: ' + match.decode('utf-8')
Simon Heimberg
run-tests: suggest to append glob when only path sep does not match...
r20273 else:
return bool(match) # do not return match object
Simon Heimberg
tests: new test for line matching functions in run-tests...
r20271
def wintests():
r"""test matching like running on windows
enable windows matching on any os
>>> _osaltsep = os.altsep
>>> os.altsep = True
valid match on windows
Augie Fackler
test-run-tests: fix for Python 3.5...
r25061 >>> lm(b'g/a*/d (glob)\n', b'g\\abc/d\n')
Simon Heimberg
tests: new test for line matching functions in run-tests...
r20271 True
direct matching, glob unnecessary
Augie Fackler
test-run-tests: fix for Python 3.5...
r25061 >>> lm(b'g/b (glob)\n', b'g/b\n')
Simon Heimberg
run-tests: print more information on unnecessary glob matching...
r20274 'special: -glob'
Simon Heimberg
tests: new test for line matching functions in run-tests...
r20271
missing glob
Augie Fackler
test-run-tests: fix for Python 3.5...
r25061 >>> lm(b'/g/c/d/fg\n', b'\\g\\c\\d/fg\n')
Simon Heimberg
run-tests: suggest to append glob when only path sep does not match...
r20273 'special: +glob'
Simon Heimberg
tests: new test for line matching functions in run-tests...
r20271
restore os.altsep
>>> os.altsep = _osaltsep
"""
Simon Heimberg
tests: fix test-run-tests.py on OS X...
r20284 pass
Simon Heimberg
tests: new test for line matching functions in run-tests...
r20271
def otherostests():
r"""test matching like running on non-windows os
disable windows matching on any os
>>> _osaltsep = os.altsep
>>> os.altsep = False
backslash does not match slash
Augie Fackler
test-run-tests: fix for Python 3.5...
r25061 >>> lm(b'h/a* (glob)\n', b'h\\ab\n')
Simon Heimberg
tests: new test for line matching functions in run-tests...
r20271 False
direct matching glob can not be recognized
Augie Fackler
test-run-tests: fix for Python 3.5...
r25061 >>> lm(b'h/b (glob)\n', b'h/b\n')
Simon Heimberg
tests: new test for line matching functions in run-tests...
r20271 True
missing glob can not not be recognized
Augie Fackler
test-run-tests: fix for Python 3.5...
r25061 >>> lm(b'/h/c/df/g/\n', b'\\h/c\\df/g\\\n')
Simon Heimberg
tests: new test for line matching functions in run-tests...
r20271 False
restore os.altsep
>>> os.altsep = _osaltsep
"""
pass
if __name__ == '__main__':
doctest.testmod()