File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ Fixed issue where sequences were still being shortened even with ``-vv `` verbosity.
Original file line number Diff line number Diff line change 2828
2929from _pytest ._io .saferepr import DEFAULT_REPR_MAX_SIZE
3030from _pytest ._io .saferepr import saferepr
31+ from _pytest ._io .saferepr import saferepr_unlimited
3132from _pytest ._version import version
3233from _pytest .assertion import util
3334from _pytest .config import Config
@@ -433,6 +434,8 @@ def _saferepr(obj: object) -> str:
433434 return obj .__name__
434435
435436 maxsize = _get_maxsize_for_saferepr (util ._config )
437+ if not maxsize :
438+ return saferepr_unlimited (obj ).replace ("\n " , "\\ n" )
436439 return saferepr (obj , maxsize = maxsize ).replace ("\n " , "\\ n" )
437440
438441
Original file line number Diff line number Diff line change @@ -2617,6 +2617,35 @@ def test():
26172617 )
26182618
26192619
2620+ def test_full_sequence_print_with_vv (
2621+ monkeypatch : MonkeyPatch , pytester : Pytester
2622+ ) -> None :
2623+ """Do not truncate sequences in summaries with -vv (#11777)."""
2624+ monkeypatch .setattr (_pytest .terminal , "running_on_ci" , lambda : False )
2625+
2626+ pytester .makepyfile (
2627+ """
2628+ def test_len_list():
2629+ l = list(range(10))
2630+ assert len(l) == 9
2631+
2632+ def test_len_dict():
2633+ d = dict(zip(range(10), range(10)))
2634+ assert len(d) == 9
2635+ """
2636+ )
2637+
2638+ result = pytester .runpytest ("-vv" )
2639+ assert result .ret == 1
2640+ result .stdout .fnmatch_lines (
2641+ [
2642+ "*short test summary info*" ,
2643+ f"*{ list (range (10 ))} *" ,
2644+ f"*{ dict (zip (range (10 ), range (10 )))} *" ,
2645+ ]
2646+ )
2647+
2648+
26202649def test_force_short_summary (monkeypatch : MonkeyPatch , pytester : Pytester ) -> None :
26212650 monkeypatch .setattr (_pytest .terminal , "running_on_ci" , lambda : False )
26222651
You can’t perform that action at this time.
0 commit comments