I kept bumping into an issue with pytest when working with JSON formats where it wouldn’t show the whole diff of the expected output. It cut off after certain amount of bytes with this mysterious message about disabling the truncating: “Set self.maxDiff to None to see it.” As I’m working only with pytest functions, this was quite baffling and even LLMs didn’t seem to know an easy solution.
Turns out this is a feature of the builtin unittest framework (which pytest builds on). Here’s a simple trick that worked for me:
# in the beginning of conftest.py
import unittest
unittest.TestCase.maxDiff = None