This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: struni: make test_mailbox and test_old_mailbox pass
Type: Stage:
Components: Library (Lib) Versions: Python 3.0
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: alexandre.vassalotti, gvanrossum
Priority: normal Keywords: patch

Created on 2007-07-20 22:45 by alexandre.vassalotti, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
01_fix_mailbox.patch alexandre.vassalotti, 2007-07-20 22:45
02_better_failure_msg.patch alexandre.vassalotti, 2007-07-20 22:49
02_better_failure_msg.patch alexandre.vassalotti, 2007-07-21 01:17
Messages (6)
msg52925 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2007-07-20 22:45
This patch make reads to a file return a string of the str type. This required to change the mode of certain call to open() to non-binary. I have no idea if this will cause problem, but at least the tests pass. If someone wants to keep opening these file in binary mode, then he will have to create a "proxy" class, like _ProxyFile in mailbox.py but with writing support, since file opened in binary mode always return string of the bytes type. Another solution would be to wrap every read() and readline() calls, on these files, with str().
msg52926 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2007-07-20 22:49
Here another patch that makes the failure message a little more descriptive.

To apply both:

   cat 01_fix_mailbox.patch 02_better_failure_msg.patch | patch -p0

File Added: 02_better_failure_msg.patch
msg52927 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-07-21 00:20
Am I supposed to apply both patches one after another?

I still get two errors:

======================================================================
ERROR: test_add_and_close (__main__.TestMbox)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_mailbox.py", line 737, in test_add_and_close
    self.assertEqual(contents == open(self._path, 'r').read())
TypeError: failUnlessEqual() takes at least 3 positional arguments (2 given)

======================================================================
ERROR: test_add_and_close (__main__.TestMMDF)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_mailbox.py", line 737, in test_add_and_close
    self.assertEqual(contents == open(self._path, 'r').read())
TypeError: failUnlessEqual() takes at least 3 positional arguments (2 given)

----------------------------------------------------------------------

msg52928 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-07-21 00:21
Looks like that was a bug in the second patch.  I'll ignore it for now.

The main patch is:
Committed revision 56474.
msg52929 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2007-07-21 01:17
I corrected the patch. It was a small error that slipped through when I separated to two changes to make them easier to review. (Sometime, I wish svn had a checkpoint feature or offline commits for this...)     

File Added: 02_better_failure_msg.patch
msg52930 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-07-27 05:18
Applied 02_better_failure_msg.patch as well (with minor tweaks to remove redundant trailing \ and one you missed :-).
Committed revision 56563.

History
Date User Action Args
2022-04-11 14:56:25adminsetgithub: 45232
2008-01-06 22:29:45adminsetkeywords: - py3k
versions: + Python 3.0
2007-07-20 22:45:08alexandre.vassalotticreate