homepage

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: FAIL: test_crlf_separation (email.test.t
Type: Stage:
Components: Windows Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: barry Nosy List: barry, jackjansen, makaron, tim.peters
Priority: normal Keywords:

Created on 2002年10月28日 10:13 by makaron, last changed 2022年04月10日 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
demo.py makaron, 2003年01月02日 11:29
Messages (7)
msg12965 - (view) Author: Grzegorz Makarewicz (makaron) Date: 2002年10月28日 10:13
just because text file on windows has CR/LF as endline
maker and this test expects LF as eol.
msg12966 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2002年10月28日 15:33
Logged In: YES 
user_id=31435
Assigned to Barry. Grzegorz, please supply more detail, 
such as which version of Python you're using, and the 
commands you used to run this test.
As the name of the test should imply ("test_crlf_....), the 
test *expects* CR/LF -- that's it's point. It passes for me 
under 2.2.2 and current CVS Python, under Win98SE and 
Win2K. It may not have passed in 2.2.1, though.
msg12967 - (view) Author: Grzegorz Makarewicz (makaron) Date: 2002年10月29日 11:28
Logged In: YES 
user_id=115179
Python 2.2.2 from October 14, 2002, compiled from source on
windows 2000
all expected test are passed but not test_email.
reproducable by:
pushd Lib\test
..\..\python regrtest.py
popd
--
or
cd Lib\test
..\..\python test_email.py
traceback:
FAILED (failures=1)
Traceback (most recent call last):
 File "test_email.py", line 13, in ?
 test_main()
 File "test_email.py", line 10, in test_main
 run_suite(suite())
 File "c:\binw\py222\lib\test\test_support.py", line 175,
in run_suite
 raise TestFailed(err)
test_support.TestFailed: Traceback (most recent call last):
 File "c:\binw\py222\lib\email\test\test_email.py", line
1851, in test_crlf_sep
aration
 eq(part1.get_payload(), 'Simple email with
attachment.\r\n\r\n')
 File "c:\binw\py222\lib\unittest.py", line 286, in
failUnlessEqual
 raise self.failureException, \
AssertionError: 'Simple email with attachment.\n\n' !=
'Simple email with attach
ment.\r\n\r\n'
after applying this patch thist test will pass
--- test_email.py Mon Oct 14 17:26:03 2002
+++ test_email.py.new Tue Oct 29 11:25:54 2002
@@ -46,7 +46,7 @@
 
 def openfile(filename):
 path = os.path.join(os.path.dirname(landmark), 'data',
filename)
- return open(path, 'r')
+ return open(path, 'rb')
msg12968 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2002年12月30日 19:26
Logged In: YES 
user_id=12800
It looks like you built this from source on Windows. If you
unzip'd the source without turning off any dumb CRLF munging
in your zip program, the test file will not be correct and
this test will fail. 
Tim assures me that this test succeeds in Python 2.2 and
2.3a1 and I trust him with my lunch.
msg12969 - (view) Author: Grzegorz Makarewicz (makaron) Date: 2003年01月02日 11:29
Logged In: YES 
user_id=115179
:( - after unpacking python on linux and copying all files
with ordinary copy this test still fails for me (Info zip
works fine on windows, gifs and other binary files are
uncompressed correctly).
Can you run attached file on your windows ?
It is stripped down test_crlf_separation which uses
StringIO, binary and text open mode. When using text mode as
in mentioned test msg.get_payload will return data
terminated with \n - but it is tested for \r\n.
msg12970 - (view) Author: Jack Jansen (jackjansen) * (Python committer) Date: 2003年01月06日 13:10
Logged In: YES 
user_id=45365
Barry,
I'm opening this one again, because on the Macintosh I still have one more problem with test_crlf_separation.
The change you made in the repository (mark the file as binary) was half the fix, but I needed to do another thing as well: open the test file in binary mode. On Windows and Unix you can open the file in text mode (for Windows there's no problem at all, for Unix there will be '\r' at the end of each line, but that is handled), but not so on the mac ('\r\n' in the file will be converted to '\n\r' upon reading, which results in \r at the beginning of each line).
I checked in a fix for this (test_email.py, rev. 1.28.2.1), let me know whether you agree with this, then I'll check it in on the trunk too.
msg12971 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2003年01月06日 15:38
Logged In: YES 
user_id=12800
Jack, the change actually /is/ made on the trunk, exactly as
you proposed. :) Closing this one again.
History
Date User Action Args
2022年04月10日 16:05:47adminsetgithub: 37378
2002年10月28日 10:13:38makaroncreate

AltStyle によって変換されたページ (->オリジナル) /