Skip to content
Advertisement

How to set self.maxDiff in nose to get full diff output?

When using nose 1.2.1 with Python 3.3.0, I sometimes get an error message similar to the following one

JavaScript

In many situations, to figure out what the error really is, I need to see the full diff output. However, I have no idea of how to set that self.maxDiff. Googling for nose and maxDiff does not help. With the same version of nose on Python 2.7.1 the full diff is printed to screen.

Here is a simple script that generates the error above when run with nosetests-3.3:

JavaScript

Advertisement

Answer

I had the same problem in Python 3 (from reading the other answers here) and using im_class did not work. The snippet below works in Python 3 (cf. How to find instance of a bound method in Python?):

JavaScript

As @Louis commented, the convenience functions are bound methods on a Dummy instance. They all seem to be on the same instance, so changing this for e.g. assert_equal will change it for assert_dict_equal et cetera. From the Python docs, __self__ is available from Python 2.6 and forward.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement