@@ -2377,8 +2377,13 @@ def mock_get_pos(*args):
23772377
23782378 monkeypatch .setattr (_pytest .terminal , "_get_node_id_with_markup" , mock_get_pos )
23792379
2380+ class Namespace :
2381+ def __init__ (self , ** kwargs ):
2382+ self .__dict__ .update (kwargs )
2383+
23802384 class config :
2381- pass
2385+ def __init__ (self ):
2386+ self .option = Namespace (verbose = 0 )
23822387
23832388 class rep :
23842389 def _get_verbose_word (self , * args ):
@@ -2399,7 +2404,7 @@ def markup(self, word: str, **markup: str):
23992404 if msg :
24002405 rep .longrepr .reprcrash .message = msg # type: ignore
24012406 actual = _get_line_with_reprcrash_message (
2402- config , # type: ignore[arg-type]
2407+ config () , # type: ignore[arg-type]
24032408 rep (), # type: ignore[arg-type]
24042409 DummyTerminalWriter (), # type: ignore[arg-type]
24052410 {},
@@ -2443,6 +2448,43 @@ def markup(self, word: str, **markup: str):
24432448 check ("🉐🉐🉐🉐🉐\n 2nd line" , 80 , "FAILED nodeid::🉐::withunicode - 🉐🉐🉐🉐🉐" )
24442449
24452450
2451+ def test_short_summary_with_verbose (
2452+ monkeypatch : MonkeyPatch , pytester : Pytester
2453+ ) -> None :
2454+ """With -vv do not truncate the summary info (#11777)."""
2455+ # On CI we also do not truncate the summary info, monkeypatch it to ensure we
2456+ # are testing against the -vv flag on CI.
2457+ monkeypatch .setattr (_pytest .terminal , "running_on_ci" , lambda : False )
2458+
2459+ string_length = 200
2460+ pytester .makepyfile (
2461+ f"""
2462+ def test():
2463+ s1 = "A" * { string_length }
2464+ s2 = "B" * { string_length }
2465+ assert s1 == s2
2466+ """
2467+ )
2468+
2469+ # No -vv, summary info should be truncated.
2470+ result = pytester .runpytest ()
2471+ result .stdout .fnmatch_lines (
2472+ [
2473+ "*short test summary info*" ,
2474+ "* assert 'AAA..." ,
2475+ ],
2476+ )
2477+
2478+ # No truncation with -vv.
2479+ result = pytester .runpytest ("-vv" )
2480+ result .stdout .fnmatch_lines (
2481+ [
2482+ "*short test summary info*" ,
2483+ f"*{ 'A' * string_length } *{ 'B' * string_length } '" ,
2484+ ]
2485+ )
2486+
2487+
24462488@pytest .mark .parametrize (
24472489 "seconds, expected" ,
24482490 [
0 commit comments