comparison tests/test-debugcommands.t @ 45055:4c1b4805db57

pycompat: change users of pycompat.{stdin,stdout,stderr} to use procutil.std* On Python 3, pycompat.{stdin,stdout,stderr} are usually block-buffered even if connected to a TTY. procutil.{stdin,stdout,stderr} provide consistent behavior across platforms and Python versions.
author Manuel Jacob <me@manueljacob.de>
date Mon, 06 Jul 2020 17:44:25 +0200
parents a7b7a67b79c1
children 7015b0232c5e
comparison
equal deleted inserted replaced
45054:922dbf0df4f1 45055:4c1b4805db57
571 Test internal debugstacktrace command 571 Test internal debugstacktrace command
572 572
573 $ cat > debugstacktrace.py << EOF 573 $ cat > debugstacktrace.py << EOF
574 > from __future__ import absolute_import 574 > from __future__ import absolute_import
575 > from mercurial import ( 575 > from mercurial import (
576 > pycompat,
577 > util, 576 > util,
578 > ) 577 > )
578 > from mercurial.utils import (
579 > procutil,
580 > )
579 > def f(): 581 > def f():
580 > util.debugstacktrace(f=pycompat.stdout) 582 > util.debugstacktrace(f=procutil.stdout)
581 > g() 583 > g()
582 > def g(): 584 > def g():
583 > util.dst(b'hello from g\\n', skip=1) 585 > util.dst(b'hello from g\\n', skip=1)
584 > h() 586 > h()
585 > def h(): 587 > def h():
586 > util.dst(b'hi ...\\nfrom h hidden in g', 1, depth=2) 588 > util.dst(b'hi ...\\nfrom h hidden in g', 1, depth=2)
587 > f() 589 > f()
588 > EOF 590 > EOF
589 $ "$PYTHON" debugstacktrace.py 591 $ "$PYTHON" debugstacktrace.py
590 stacktrace at: 592 stacktrace at:
591 *debugstacktrace.py:14 in * (glob) 593 *debugstacktrace.py:16 in * (glob)
592 *debugstacktrace.py:7 in f (glob) 594 *debugstacktrace.py:9 in f (glob)
593 hello from g at: 595 hello from g at:
594 *debugstacktrace.py:14 in * (glob) 596 *debugstacktrace.py:16 in * (glob)
595 *debugstacktrace.py:8 in f (glob) 597 *debugstacktrace.py:10 in f (glob)
596 hi ... 598 hi ...
597 from h hidden in g at: 599 from h hidden in g at:
598 *debugstacktrace.py:8 in f (glob) 600 *debugstacktrace.py:10 in f (glob)
599 *debugstacktrace.py:11 in g (glob) 601 *debugstacktrace.py:13 in g (glob)
600 602
601 Test debugcapabilities command: 603 Test debugcapabilities command:
602 604
603 $ hg debugcapabilities ./debugrevlog/ 605 $ hg debugcapabilities ./debugrevlog/
604 Main capabilities: 606 Main capabilities: