test_unicode_file fails on Linux

The utime() call is failing for one of the Unicode file names. build> ./python ../Lib/test/test_unicode_file.py test_directories (__main__.TestUnicodeFiles) ... ok test_equivalent_files (__main__.TestUnicodeFiles) ... ok test_single_files (__main__.TestUnicodeFiles) ... '@test-\xc3\xa0\xc3\xb2' '@test-\xc3\xa0\xc3\xb2' u'@test-\xe0\xf2' ERROR ====================================================================== ERROR: test_single_files (__main__.TestUnicodeFiles) ---------------------------------------------------------------------- Traceback (most recent call last): File "../Lib/test/test_unicode_file.py", line 143, in test_single_files self._test_single(TESTFN_UNICODE) File "../Lib/test/test_unicode_file.py", line 117, in _test_single self._do_single(filename) File "../Lib/test/test_unicode_file.py", line 33, in _do_single os.utime(filename, None) UnicodeEncodeError: 'ascii' codec can't encode characters in position 6-7: ordinal not in range(128) I'm running on a RH9 system. I see that the code hasn't changed since the beginning of the month, so I'm surprised to only discover it now. I can't recall the last time I did a full test run, so I'm not sure how long it has been failing. Jeremy

Jeremy> The utime() call is failing for one of the Unicode file names. Been failing for me for awhile (Mac OS X), but in a bit different fashion: % ./python.exe ../Lib/test/regrtest.py -v test_unicode_file test_unicode_file test_directories (test.test_unicode_file.TestUnicodeFiles) ... FAIL test_equivalent_files (test.test_unicode_file.TestUnicodeFiles) ... ok test_single_files (test.test_unicode_file.TestUnicodeFiles) ... FAIL ====================================================================== FAIL: test_directories (test.test_unicode_file.TestUnicodeFiles) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/skip/src/python/head/dist/src/Lib/test/test_unicode_file.py", line 155, in test_directories self._do_directory(TESTFN_ENCODED+ext, TESTFN_ENCODED+ext, os.getcwd) File "/Users/skip/src/python/head/dist/src/Lib/test/test_unicode_file.py", line 103, in _do_directory make_name) AssertionError: '@test-a\xcc\x80o\xcc\x80.dir' != '@test-\xc3\xa0\xc3\xb2.dir' ====================================================================== FAIL: test_single_files (test.test_unicode_file.TestUnicodeFiles) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/skip/src/python/head/dist/src/Lib/test/test_unicode_file.py", line 141, in test_single_files self._test_single(TESTFN_ENCODED) File "/Users/skip/src/python/head/dist/src/Lib/test/test_unicode_file.py", line 116, in _test_single self._do_single(filename) File "/Users/skip/src/python/head/dist/src/Lib/test/test_unicode_file.py", line 41, in _do_single self.failUnless(base in os.listdir(path)) AssertionError ---------------------------------------------------------------------- Ran 3 tests in 0.031s FAILED (failures=2) test test_unicode_file failed -- errors occurred; run in verbose mode for details 1 test failed: test_unicode_file I thought this was a known issue (Unicode normalization differences?), so didn't bother to report it. Skip

[Jeremy Hylton]
It's been failing "quite a while" on Win98SE too, in the same way. I believe MarkH knows (or should know) about it already, but he's on vacation now: C:\Code\python\PCbuild>python ../lib/test/test_unicode_file.py test_directories (__main__.TestUnicodeFiles) ... ok test_equivalent_files (__main__.TestUnicodeFiles) ... ok test_single_files (__main__.TestUnicodeFiles) ... ERROR ====================================================================== ERROR: test_single_files (__main__.TestUnicodeFiles) ---------------------------------------------------------------------- Traceback (most recent call last): File "../lib/test/test_unicode_file.py", line 142, in test_single_files self._test_single(TESTFN_UNICODE) File "../lib/test/test_unicode_file.py", line 116, in _test_single self._do_single(filename) File "../lib/test/test_unicode_file.py", line 32, in _do_single os.utime(filename, None) UnicodeEncodeError: 'ascii' codec can't encode characters in position 6-7: ordinal not in range(128) ---------------------------------------------------------------------- Ran 3 tests in 0.160s FAILED (errors=1) Traceback (most recent call last): File "../lib/test/test_unicode_file.py", line 171, in ? test_main() File "../lib/test/test_unicode_file.py", line 168, in test_main run_suite(suite) File "C:\CODE\PYTHON\lib\test\test_support.py", line 275, in run_suite raise TestFailed(err) test.test_support.TestFailed: Traceback (most recent call last): File "../lib/test/test_unicode_file.py", line 142, in test_single_files self._test_single(TESTFN_UNICODE) File "../lib/test/test_unicode_file.py", line 116, in _test_single self._do_single(filename) File "../lib/test/test_unicode_file.py", line 32, in _do_single os.utime(filename, None) UnicodeEncodeError: 'ascii' codec can't encode characters in position 6-7: ordinal not in range(128) test_urllib2 is also failing on Win98SE, and that's more recent: C:\Code\python\PCbuild>python ../lib/test/test_urllib2.py test_trivial (__main__.TrivialTests) ... ok test_handled (__main__.OpenerDirectorTests) ... ok test_handler_order (__main__.OpenerDirectorTests) ... ok test_http_error (__main__.OpenerDirectorTests) ... ok test_processors (__main__.OpenerDirectorTests) ... ok test_raise (__main__.OpenerDirectorTests) ... ok test_errors (__main__.HandlerTests) ... ok test_file (__main__.HandlerTests) ... ERROR test_ftp (__main__.HandlerTests) ... ok test_http (__main__.HandlerTests) ... ok test_redirect (__main__.HandlerTests) ... ok test_build_opener (__main__.MiscTests) ... ok ====================================================================== ERROR: test_file (__main__.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "../lib/test/test_urllib2.py", line 345, in test_file r = h.file_open(Request(url)) File "C:\CODE\PYTHON\lib\urllib2.py", line 1058, in file_open return self.open_local_file(req) File "C:\CODE\PYTHON\lib\urllib2.py", line 1073, in open_local_file stats = os.stat(localfile) OSError: [Errno 2] No such file or directory: '\\test.txt' ---------------------------------------------------------------------- Ran 12 tests in 0.170s FAILED (errors=1) Traceback (most recent call last): File "../lib/test/test_urllib2.py", line 628, in ? test_main(verbose=True) File "../lib/test/test_urllib2.py", line 624, in test_main MiscTests, File "C:\CODE\PYTHON\lib\test\test_support.py", line 290, in run_unittest run_suite(suite, testclass) File "C:\CODE\PYTHON\lib\test\test_support.py", line 275, in run_suite raise TestFailed(err) test.test_support.TestFailed: Traceback (most recent call last): File "../lib/test/test_urllib2.py", line 345, in test_file r = h.file_open(Request(url)) File "C:\CODE\PYTHON\lib\urllib2.py", line 1058, in file_open return self.open_local_file(req) File "C:\CODE\PYTHON\lib\urllib2.py", line 1073, in open_local_file stats = os.stat(localfile) OSError: [Errno 2] No such file or directory: '\\test.txt' test_bsddb3 is in such bad shape on Win98SE now I don't know where to begin. The compiler warnings about mixing signed and unsigned in comparisons in _sre.c also persist. Other than that, everything's great.

By default, this test is working for me on Linux. I suspect it has to do with the fact that: [skip@bobcat build]$ ./python -c 'import sys;print sys.getfilesystemencoding()' UTF-8 By way of testing, I tried: [skip@bobcat build]$ export LANG=de_DE [skip@bobcat build]$ ./python -c 'import sys;print sys.getfilesystemencoding()' ISO-8859-1 And the tests still succeeded. Trying to work with "ascii" as the encoding results in a 'TestSkipped' exception: [skip@bobcat build]$ export LANG=C [skip@bobcat build]$ ./python -c 'import sys;print sys.getfilesystemencoding()' ANSI_X3.4-1968 [skip@bobcat build]$ ./python ../Lib/test/test_unicode_file.py ... test.test_support.TestSkipped: No Unicode filesystem semantics on this platform. I even managed to get my Windows 98 box on the network again, and this also seems to work for me from current CVS. I'm really not sure what I am missing.... Mark.

[Mark Hammond]
[Hye-Shik Chang]
I guess <wink/> that I fixed it on Modules/posixmodule.c rev 2.310.
I think you did (and thanks!): test_unicode_file passes for me today on my Win98SE box too. Speaking of which, it wouldn't have been possible for me to test this if I hadn't "rehabilitated" the VC6 project files over the weekend: VC7 can't be installed on a Win9x box. I sure hope I was the only one routinely building Python on a Win9x box, though <wink>.

On Jan 6, 2004, at 8:01 PM, Thomas Heller wrote: ...
I used to do it pretty often on tartina, my old win98 laptop (which is why I didn't even ask to be considered as one of the MSVC 7 giftees back when MS offered -- I knew VS 7 doesn't run on win98). But since July I haven't really worked on any Windows contracts -- it's been mostly Linux (with some prospect of Mac OS X now on the horizon) -- and tartina's batteries have been nearly dead (RIP) so it's not very usable anymore on trips &c... Alex

Jeremy> The utime() call is failing for one of the Unicode file names. Been failing for me for awhile (Mac OS X), but in a bit different fashion: % ./python.exe ../Lib/test/regrtest.py -v test_unicode_file test_unicode_file test_directories (test.test_unicode_file.TestUnicodeFiles) ... FAIL test_equivalent_files (test.test_unicode_file.TestUnicodeFiles) ... ok test_single_files (test.test_unicode_file.TestUnicodeFiles) ... FAIL ====================================================================== FAIL: test_directories (test.test_unicode_file.TestUnicodeFiles) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/skip/src/python/head/dist/src/Lib/test/test_unicode_file.py", line 155, in test_directories self._do_directory(TESTFN_ENCODED+ext, TESTFN_ENCODED+ext, os.getcwd) File "/Users/skip/src/python/head/dist/src/Lib/test/test_unicode_file.py", line 103, in _do_directory make_name) AssertionError: '@test-a\xcc\x80o\xcc\x80.dir' != '@test-\xc3\xa0\xc3\xb2.dir' ====================================================================== FAIL: test_single_files (test.test_unicode_file.TestUnicodeFiles) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/skip/src/python/head/dist/src/Lib/test/test_unicode_file.py", line 141, in test_single_files self._test_single(TESTFN_ENCODED) File "/Users/skip/src/python/head/dist/src/Lib/test/test_unicode_file.py", line 116, in _test_single self._do_single(filename) File "/Users/skip/src/python/head/dist/src/Lib/test/test_unicode_file.py", line 41, in _do_single self.failUnless(base in os.listdir(path)) AssertionError ---------------------------------------------------------------------- Ran 3 tests in 0.031s FAILED (failures=2) test test_unicode_file failed -- errors occurred; run in verbose mode for details 1 test failed: test_unicode_file I thought this was a known issue (Unicode normalization differences?), so didn't bother to report it. Skip

[Jeremy Hylton]
It's been failing "quite a while" on Win98SE too, in the same way. I believe MarkH knows (or should know) about it already, but he's on vacation now: C:\Code\python\PCbuild>python ../lib/test/test_unicode_file.py test_directories (__main__.TestUnicodeFiles) ... ok test_equivalent_files (__main__.TestUnicodeFiles) ... ok test_single_files (__main__.TestUnicodeFiles) ... ERROR ====================================================================== ERROR: test_single_files (__main__.TestUnicodeFiles) ---------------------------------------------------------------------- Traceback (most recent call last): File "../lib/test/test_unicode_file.py", line 142, in test_single_files self._test_single(TESTFN_UNICODE) File "../lib/test/test_unicode_file.py", line 116, in _test_single self._do_single(filename) File "../lib/test/test_unicode_file.py", line 32, in _do_single os.utime(filename, None) UnicodeEncodeError: 'ascii' codec can't encode characters in position 6-7: ordinal not in range(128) ---------------------------------------------------------------------- Ran 3 tests in 0.160s FAILED (errors=1) Traceback (most recent call last): File "../lib/test/test_unicode_file.py", line 171, in ? test_main() File "../lib/test/test_unicode_file.py", line 168, in test_main run_suite(suite) File "C:\CODE\PYTHON\lib\test\test_support.py", line 275, in run_suite raise TestFailed(err) test.test_support.TestFailed: Traceback (most recent call last): File "../lib/test/test_unicode_file.py", line 142, in test_single_files self._test_single(TESTFN_UNICODE) File "../lib/test/test_unicode_file.py", line 116, in _test_single self._do_single(filename) File "../lib/test/test_unicode_file.py", line 32, in _do_single os.utime(filename, None) UnicodeEncodeError: 'ascii' codec can't encode characters in position 6-7: ordinal not in range(128) test_urllib2 is also failing on Win98SE, and that's more recent: C:\Code\python\PCbuild>python ../lib/test/test_urllib2.py test_trivial (__main__.TrivialTests) ... ok test_handled (__main__.OpenerDirectorTests) ... ok test_handler_order (__main__.OpenerDirectorTests) ... ok test_http_error (__main__.OpenerDirectorTests) ... ok test_processors (__main__.OpenerDirectorTests) ... ok test_raise (__main__.OpenerDirectorTests) ... ok test_errors (__main__.HandlerTests) ... ok test_file (__main__.HandlerTests) ... ERROR test_ftp (__main__.HandlerTests) ... ok test_http (__main__.HandlerTests) ... ok test_redirect (__main__.HandlerTests) ... ok test_build_opener (__main__.MiscTests) ... ok ====================================================================== ERROR: test_file (__main__.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "../lib/test/test_urllib2.py", line 345, in test_file r = h.file_open(Request(url)) File "C:\CODE\PYTHON\lib\urllib2.py", line 1058, in file_open return self.open_local_file(req) File "C:\CODE\PYTHON\lib\urllib2.py", line 1073, in open_local_file stats = os.stat(localfile) OSError: [Errno 2] No such file or directory: '\\test.txt' ---------------------------------------------------------------------- Ran 12 tests in 0.170s FAILED (errors=1) Traceback (most recent call last): File "../lib/test/test_urllib2.py", line 628, in ? test_main(verbose=True) File "../lib/test/test_urllib2.py", line 624, in test_main MiscTests, File "C:\CODE\PYTHON\lib\test\test_support.py", line 290, in run_unittest run_suite(suite, testclass) File "C:\CODE\PYTHON\lib\test\test_support.py", line 275, in run_suite raise TestFailed(err) test.test_support.TestFailed: Traceback (most recent call last): File "../lib/test/test_urllib2.py", line 345, in test_file r = h.file_open(Request(url)) File "C:\CODE\PYTHON\lib\urllib2.py", line 1058, in file_open return self.open_local_file(req) File "C:\CODE\PYTHON\lib\urllib2.py", line 1073, in open_local_file stats = os.stat(localfile) OSError: [Errno 2] No such file or directory: '\\test.txt' test_bsddb3 is in such bad shape on Win98SE now I don't know where to begin. The compiler warnings about mixing signed and unsigned in comparisons in _sre.c also persist. Other than that, everything's great.

By default, this test is working for me on Linux. I suspect it has to do with the fact that: [skip@bobcat build]$ ./python -c 'import sys;print sys.getfilesystemencoding()' UTF-8 By way of testing, I tried: [skip@bobcat build]$ export LANG=de_DE [skip@bobcat build]$ ./python -c 'import sys;print sys.getfilesystemencoding()' ISO-8859-1 And the tests still succeeded. Trying to work with "ascii" as the encoding results in a 'TestSkipped' exception: [skip@bobcat build]$ export LANG=C [skip@bobcat build]$ ./python -c 'import sys;print sys.getfilesystemencoding()' ANSI_X3.4-1968 [skip@bobcat build]$ ./python ../Lib/test/test_unicode_file.py ... test.test_support.TestSkipped: No Unicode filesystem semantics on this platform. I even managed to get my Windows 98 box on the network again, and this also seems to work for me from current CVS. I'm really not sure what I am missing.... Mark.

[Mark Hammond]
[Hye-Shik Chang]
I guess <wink/> that I fixed it on Modules/posixmodule.c rev 2.310.
I think you did (and thanks!): test_unicode_file passes for me today on my Win98SE box too. Speaking of which, it wouldn't have been possible for me to test this if I hadn't "rehabilitated" the VC6 project files over the weekend: VC7 can't be installed on a Win9x box. I sure hope I was the only one routinely building Python on a Win9x box, though <wink>.

On Jan 6, 2004, at 8:01 PM, Thomas Heller wrote: ...
I used to do it pretty often on tartina, my old win98 laptop (which is why I didn't even ask to be considered as one of the MSVC 7 giftees back when MS offered -- I knew VS 7 doesn't run on win98). But since July I haven't really worked on any Windows contracts -- it's been mostly Linux (with some prospect of Mac OS X now on the horizon) -- and tartina's batteries have been nearly dead (RIP) so it's not very usable anymore on trips &c... Alex
participants (7)
-
Alex Martelli
-
Hye-Shik Chang
-
Jeremy Hylton
-
Mark Hammond
-
Skip Montanaro
-
Thomas Heller
-
Tim Peters