On Sat, 20 Nov 2010 16:34:26 +0100 (CET) michael.foord <python-check...@python.org> wrote: > + > + def testPickle(self): > + # Issue 10326 > + > + # Can't use TestCase classes defined in Test class as > + # pickle does not work with inner classes > + test = unittest.TestCase('run') > + for protocol in range(pickle.HIGHEST_PROTOCOL + 1): > + > + # blew up prior to fix > + pickled_test = pickle.dumps(test, protocol=protocol)
You must also check that the object can be unpickled, otherwise making TestCase picklable is not only pointless, but misleading the user. Other classes which claim to be picklable (such as e.g. io.BytesIO) are careful to check that unpickling works fine and produces an usable object. Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com