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: test_sutil fails on cygwin
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jlgijsbers Nosy List: jlgijsbers, tebeka
Priority: normal Keywords:

Created on 2004-11-23 08:29 by tebeka, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg23254 - (view) Author: Miki Tebeka (tebeka) * Date: 2004-11-23 08:29
[10:23] $python -V
Python 2.4c1
[10:25] $python -c 'from test.test_shutil import
test_main; test_main()' -v
test_dont_copy_file_onto_link_to_itself
(test.test_shutil.TestShutil) ... ok
test_dont_move_dir_in_itself
(test.test_shutil.TestShutil) ... ok
test_on_error (test.test_shutil.TestShutil) ... ERROR
test_rmtree_dont_delete_file
(test.test_shutil.TestShutil) ... ok
test_rmtree_errors (test.test_shutil.TestShutil) ... ok

======================================================================
ERROR: test_on_error (test.test_shutil.TestShutil)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.4/test/test_shutil.py", line
34, in test_on_error
    os.chmod(TESTFN, old_dir_mode)
OSError: [Errno 2] No such file or directory: '@test'

----------------------------------------------------------------------
Ran 5 tests in 0.036s

FAILED (errors=1)
Traceback (most recent call last):
  File "<string>", line 1, in ?
  File "/usr/lib/python2.4/test/test_shutil.py", line
99, in test_main
    test_support.run_unittest(TestShutil)
  File "/usr/lib/python2.4/test/test_support.py", line
290, in run_unittest
    run_suite(suite, testclass)
  File "/usr/lib/python2.4/test/test_support.py", line
275, in run_suite
    raise TestFailed(err)
test.test_support.TestFailed: Traceback (most recent
call last):
  File "/usr/lib/python2.4/test/test_shutil.py", line
34, in test_on_error
    os.chmod(TESTFN, old_dir_mode)
OSError: [Errno 2] No such file or directory: '@test'

msg23255 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-11-23 09:29
Logged In: YES 
user_id=469548

Ah, seems like chmod doesn't work on Cygwin. That means
there's no way to run this test there, so I've changed it so
that it doesn't run on Cygwin anymore.
msg23256 - (view) Author: Miki Tebeka (tebeka) * Date: 2004-11-23 09:41
Logged In: YES 
user_id=358087

I disagree, chmod seems to work:
[11:35] - adp96: touch zzz
[11:35] - adp96: ll zzz
-rw-rw-rw-    1 mikit    Domain U        0 Nov 23 11:35 zzz
[11:35] - adp96: python -c 'from os import chmod;
chmod("zzz", 0700)'
[11:36] - adp96: ll zzz
-rwx------    1 mikit    Domain U        0 Nov 23 11:35 zzz
msg23257 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-11-23 10:04
Logged In: YES 
user_id=469548

Hmm, strange. I should perhaps have provided the link that I
based this on: http://www.cygwin.com/faq/faq_3.html#SEC41. 
The thing is, the test needs a permissions error so it can
check shutil.rmtree's error handling. Setting the
permissions for the directory to stat.S_IREAD (0400) doesn't
seem to prevent Python from removing the file. I don't know
enough about the intricacies of Cygwin+chmod (I don't have a
Windows machine) to make this work reliably, but I'll be
happy to take another patch.

Note, by the way, that this is not a problem with shutil
itself, but just with the test.
msg23258 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-12-06 20:53
Logged In: YES 
user_id=469548

Closing this. I've added a comment to the source pointing to
here.
History
Date User Action Args
2022-04-11 14:56:08adminsetgithub: 41209
2004-11-23 08:29:15tebekacreate