File tree Expand file tree Collapse file tree 3 files changed +5
-2
lines changed Expand file tree Collapse file tree 3 files changed +5
-2
lines changed Original file line number Diff line number Diff line change
1
+ from .terminalwriter import get_terminal_width
1
2
from .terminalwriter import TerminalWriter
2
3
3
4
4
5
__all__ = [
5
6
"TerminalWriter" ,
7
+ "get_terminal_width" ,
6
8
]
Original file line number Diff line number Diff line change 15
15
16
16
import py
17
17
18
+ import _pytest ._io
18
19
from _pytest .compat import TYPE_CHECKING
19
20
from _pytest .config .exceptions import UsageError
20
21
@@ -466,7 +467,7 @@ class DropShorterLongHelpFormatter(argparse.HelpFormatter):
466
467
def __init__ (self , * args : Any , ** kwargs : Any ) -> None :
467
468
"""Use more accurate terminal width via pylib."""
468
469
if "width" not in kwargs :
469
- kwargs ["width" ] = py . io .get_terminal_width ()
470
+ kwargs ["width" ] = _pytest . _io .get_terminal_width ()
470
471
super ().__init__ (* args , ** kwargs )
471
472
472
473
def _format_action_invocation (self , action : argparse .Action ) -> str :
Original file line number Diff line number Diff line change @@ -1253,7 +1253,7 @@ def test_help_formatter_uses_py_get_terminal_width(monkeypatch):
1253
1253
formatter = DropShorterLongHelpFormatter ("prog" )
1254
1254
assert formatter ._width == 90
1255
1255
1256
- monkeypatch .setattr ("py.io .get_terminal_width" , lambda : 160 )
1256
+ monkeypatch .setattr ("_pytest._io .get_terminal_width" , lambda : 160 )
1257
1257
formatter = DropShorterLongHelpFormatter ("prog" )
1258
1258
assert formatter ._width == 160
1259
1259
You can’t perform that action at this time.
0 commit comments