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
@@ -432,6 +433,8 @@ def _saferepr(obj: object) -> str:
432433 return obj .__name__
433434
434435 maxsize = _get_maxsize_for_saferepr (util ._config )
436+ if not maxsize :
437+ return saferepr_unlimited (obj ).replace ("\n " , "\\ n" )
435438 return saferepr (obj , maxsize = maxsize ).replace ("\n " , "\\ n" )
436439
437440
Original file line number Diff line number Diff line change @@ -2525,6 +2525,35 @@ def test():
25252525 )
25262526
25272527
2528+ def test_full_sequence_print_with_vv (
2529+ monkeypatch : MonkeyPatch , pytester : Pytester
2530+ ) -> None :
2531+ """Do not truncate sequences in summaries with -vv (#11777)."""
2532+ monkeypatch .setattr (_pytest .terminal , "running_on_ci" , lambda : False )
2533+
2534+ pytester .makepyfile (
2535+ """
2536+ def test_len_list():
2537+ l = list(range(10))
2538+ assert len(l) == 9
2539+
2540+ def test_len_dict():
2541+ d = dict(zip(range(10), range(10)))
2542+ assert len(d) == 9
2543+ """
2544+ )
2545+
2546+ result = pytester .runpytest ("-vv" )
2547+ assert result .ret == 1
2548+ result .stdout .fnmatch_lines (
2549+ [
2550+ "*short test summary info*" ,
2551+ f"*{ list (range (10 ))} *" ,
2552+ f"*{ dict (zip (range (10 ), range (10 )))} *" ,
2553+ ]
2554+ )
2555+
2556+
25282557@pytest .mark .parametrize (
25292558 "seconds, expected" ,
25302559 [
You can’t perform that action at this time.
0 commit comments