##// END OF EJS Templates
py3: use multi-line import in test-wireproto.py...
py3: use multi-line import in test-wireproto.py The reason I did it is that I had a later commit that was adding to the list.

File last commit:

r28822:b7782424 default
r28860:50d11dd8 default
Show More
test-devel-warnings.t
168 lines | 6.7 KiB | text/troff | Tads3Lexer
/ tests / test-devel-warnings.t
Pierre-Yves David
devel: move the lock-checking code into core...
r24386
$ cat << EOF > buggylocking.py
Pierre-Yves David
test: update the docstring of 'test-devel-warnings.t' extension...
r27270 > """A small extension that tests our developer warnings
Pierre-Yves David
devel: move the lock-checking code into core...
r24386 > """
>
Pierre-Yves David
devel-warn: issue a warning for old style revsets...
r25630 > from mercurial import cmdutil, repair, revset
Pierre-Yves David
devel: move the lock-checking code into core...
r24386 >
> cmdtable = {}
> command = cmdutil.command(cmdtable)
>
> @command('buggylocking', [], '')
> def buggylocking(ui, repo):
Pierre-Yves David
devel: also warn about transaction started without a lock...
r24388 > tr = repo.transaction('buggy')
Pierre-Yves David
test: don't rely on __del__ in test-devel-warnings.t...
r28822 > # make sure we rollback the transaction as we don't want to rely on the__del__
> tr.release()
Pierre-Yves David
devel: move the lock-checking code into core...
r24386 > lo = repo.lock()
> wl = repo.wlock()
Matt Mackall
tests: avoid deprecation warning
r24392 > wl.release()
> lo.release()
Pierre-Yves David
wlock: only issue devel warning when actually acquiring the lock...
r24744 >
> @command('properlocking', [], '')
> def properlocking(ui, repo):
> """check that reentrance is fine"""
> wl = repo.wlock()
> lo = repo.lock()
> tr = repo.transaction('proper')
> tr2 = repo.transaction('proper')
> lo2 = repo.lock()
> wl2 = repo.wlock()
> wl2.release()
> lo2.release()
> tr2.close()
> tr.close()
> lo.release()
> wl.release()
Pierre-Yves David
wlock: do not warn for non-wait locking...
r24750 >
> @command('nowaitlocking', [], '')
> def nowaitlocking(ui, repo):
> lo = repo.lock()
> wl = repo.wlock(wait=False)
> wl.release()
> lo.release()
Pierre-Yves David
repair: forbid strip from inside a transaction...
r25300 >
> @command('stripintr', [], '')
> def stripintr(ui, repo):
> lo = repo.lock()
> tr = repo.transaction('foobar')
> try:
> repair.strip(repo.ui, repo, [repo['.'].node()])
> finally:
> lo.release()
Pierre-Yves David
ui: add a 'deprecwarn' helper to issue deprecation warnings...
r27275 > @command('oldanddeprecated', [], '')
> def oldanddeprecated(ui, repo):
> """test deprecation warning API"""
> def foobar(ui):
> ui.deprecwarn('foorbar is deprecated, go shopping', '42.1337')
> foobar(ui)
Pierre-Yves David
devel-warn: issue a warning for old style revsets...
r25630 >
> def oldstylerevset(repo, subset, x):
> return list(subset)
>
> revset.symbols['oldstyle'] = oldstylerevset
Pierre-Yves David
devel: move the lock-checking code into core...
r24386 > EOF
$ cat << EOF >> $HGRCPATH
> [extensions]
> buggylocking=$TESTTMP/buggylocking.py
timeless
ui: log devel warnings
r28498 > mock=$TESTDIR/mockblackbox.py
> blackbox=
Pierre-Yves David
devel: move the lock-checking code into core...
r24386 > [devel]
Pierre-Yves David
devel: rename 'all' to 'all-warnings' (BC)...
r25290 > all-warnings=1
Pierre-Yves David
devel: move the lock-checking code into core...
r24386 > EOF
$ hg init lock-checker
$ cd lock-checker
$ hg buggylocking
timeless
tests: relax test-devel-warnings to reduce false positives...
r28016 devel-warn: transaction with no lock at: $TESTTMP/buggylocking.py:* (buggylocking) (glob)
devel-warn: "wlock" acquired after "lock" at: $TESTTMP/buggylocking.py:* (buggylocking) (glob)
Pierre-Yves David
devel: move the lock-checking code into core...
r24386 $ cat << EOF >> $HGRCPATH
> [devel]
> all=0
> check-locks=1
> EOF
$ hg buggylocking
timeless
tests: relax test-devel-warnings to reduce false positives...
r28016 devel-warn: transaction with no lock at: $TESTTMP/buggylocking.py:* (buggylocking) (glob)
devel-warn: "wlock" acquired after "lock" at: $TESTTMP/buggylocking.py:* (buggylocking) (glob)
Pierre-Yves David
devel: move the lock-checking code into core...
r24386 $ hg buggylocking --traceback
Pierre-Yves David
devel-warn: add a prefix to all messages ("devel-warn: ")...
r24755 devel-warn: transaction with no lock at:
Matt Mackall
tests: fix py2.4 glob for devel warnings
r24555 */hg:* in * (glob)
Pierre-Yves David
devel: also warn about transaction started without a lock...
r24388 */mercurial/dispatch.py:* in run (glob)
*/mercurial/dispatch.py:* in dispatch (glob)
*/mercurial/dispatch.py:* in _runcatch (glob)
*/mercurial/dispatch.py:* in _dispatch (glob)
*/mercurial/dispatch.py:* in runcommand (glob)
*/mercurial/dispatch.py:* in _runcommand (glob)
*/mercurial/dispatch.py:* in checkargs (glob)
*/mercurial/dispatch.py:* in <lambda> (glob)
*/mercurial/util.py:* in check (glob)
$TESTTMP/buggylocking.py:* in buggylocking (glob)
Pierre-Yves David
devel-warn: add a prefix to all messages ("devel-warn: ")...
r24755 devel-warn: "wlock" acquired after "lock" at:
Matt Mackall
tests: fix py2.4 glob for devel warnings
r24555 */hg:* in * (glob)
Pierre-Yves David
devel: move the lock-checking code into core...
r24386 */mercurial/dispatch.py:* in run (glob)
*/mercurial/dispatch.py:* in dispatch (glob)
*/mercurial/dispatch.py:* in _runcatch (glob)
*/mercurial/dispatch.py:* in _dispatch (glob)
*/mercurial/dispatch.py:* in runcommand (glob)
*/mercurial/dispatch.py:* in _runcommand (glob)
*/mercurial/dispatch.py:* in checkargs (glob)
*/mercurial/dispatch.py:* in <lambda> (glob)
*/mercurial/util.py:* in check (glob)
$TESTTMP/buggylocking.py:* in buggylocking (glob)
Pierre-Yves David
wlock: only issue devel warning when actually acquiring the lock...
r24744 $ hg properlocking
Pierre-Yves David
wlock: do not warn for non-wait locking...
r24750 $ hg nowaitlocking
Pierre-Yves David
repair: forbid strip from inside a transaction...
r25300
$ echo a > a
$ hg add a
$ hg commit -m a
$ hg stripintr
timeless
tests: relax test-devel-warnings to reduce false positives...
r28016 saved backup bundle to $TESTTMP/lock-checker/.hg/strip-backup/*-backup.hg (glob)
Pierre-Yves David
repair: forbid strip from inside a transaction...
r25300 abort: programming error: cannot strip from inside a transaction
(contact your extension maintainer)
[255]
Pierre-Yves David
devel-warn: issue a warning for old style revsets...
r25630 $ hg log -r "oldstyle()" -T '{rev}\n'
devel-warn: revset "oldstyle" use list instead of smartset, (upgrade your code) at: */mercurial/revset.py:* (mfunc) (glob)
0
Pierre-Yves David
ui: add a 'deprecwarn' helper to issue deprecation warnings...
r27275 $ hg oldanddeprecated
devel-warn: foorbar is deprecated, go shopping
timeless
tests: relax test-devel-warnings to reduce false positives...
r28016 (compatibility will be dropped after Mercurial-42.1337, update your code.) at: $TESTTMP/buggylocking.py:* (oldanddeprecated) (glob)
Pierre-Yves David
devel-warn: issue a warning for old style revsets...
r25630
Pierre-Yves David
ui: add a 'deprecwarn' helper to issue deprecation warnings...
r27275 $ hg oldanddeprecated --traceback
devel-warn: foorbar is deprecated, go shopping
(compatibility will be dropped after Mercurial-42.1337, update your code.) at:
*/hg:* in <module> (glob)
*/mercurial/dispatch.py:* in run (glob)
*/mercurial/dispatch.py:* in dispatch (glob)
*/mercurial/dispatch.py:* in _runcatch (glob)
*/mercurial/dispatch.py:* in _dispatch (glob)
*/mercurial/dispatch.py:* in runcommand (glob)
*/mercurial/dispatch.py:* in _runcommand (glob)
*/mercurial/dispatch.py:* in checkargs (glob)
*/mercurial/dispatch.py:* in <lambda> (glob)
*/mercurial/util.py:* in check (glob)
$TESTTMP/buggylocking.py:* in oldanddeprecated (glob)
timeless
ui: log devel warnings
r28498 $ hg blackbox -l 9
1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> devel-warn: revset "oldstyle" use list instead of smartset, (upgrade your code) at: */mercurial/revset.py:* (mfunc) (glob)
1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> log -r oldstyle() -T {rev}\n exited 0 after * seconds (glob)
1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated
1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> devel-warn: foorbar is deprecated, go shopping
(compatibility will be dropped after Mercurial-42.1337, update your code.) at: $TESTTMP/buggylocking.py:* (oldanddeprecated) (glob)
1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated exited 0 after * seconds (glob)
1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated --traceback
1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> devel-warn: foorbar is deprecated, go shopping
(compatibility will be dropped after Mercurial-42.1337, update your code.) at:
*/hg:* in <module> (glob)
*/mercurial/dispatch.py:* in run (glob)
*/mercurial/dispatch.py:* in dispatch (glob)
*/mercurial/dispatch.py:* in _runcatch (glob)
*/mercurial/dispatch.py:* in _dispatch (glob)
*/mercurial/dispatch.py:* in runcommand (glob)
*/mercurial/dispatch.py:* in _runcommand (glob)
*/mercurial/dispatch.py:* in checkargs (glob)
*/mercurial/dispatch.py:* in <lambda> (glob)
*/mercurial/util.py:* in check (glob)
$TESTTMP/buggylocking.py:* in oldanddeprecated (glob)
1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated --traceback exited 0 after * seconds (glob)
1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> blackbox -l 9
Pierre-Yves David
devel: move the lock-checking code into core...
r24386 $ cd ..