Hum, I didn't realize os.chmod() worked this differently on Windows.
Well, it can't work the same. At the chmod() level, there are no "user", "group" or "world"/"other" concepts on Windows. There also aren't distinct "execute"/"search", "write" and "read" bits. There are "hidden", "system", and "archive" bits on Windows, which have no equivalents on Unix, and there's a "read only" bit on Windows, setting which is kind of like turning off 0222 on Unix. The only thing chmod() is useful for on Windows is fiddling the state of the "read only" bit.
Seems like I bumped into bug #755617 (os module: Need a better description of "mode"). Per that bug, I googled for '_chmod msdn' and came up with the attached patch. However, I don't have a Windows machine handy to test. Could someone with a Windows machine try the patch?
No cigar. The patched test appears to assume that if you strip write permission from a directory, that also makes it impossible to delete files within the directory. But directories on Windows aren't files -- they're directories <wink>.
The attached patch allows the test to pass on WinXP, although I'm not sure about Win95/98/ME. If there are no objections, I'll check it in. I don't remember enough about Unix's equally obscure permission gimmicks to be sure that this patch will leave the test working on non-Windows boxes.