Issue 7108: test_commands.py failing on OS X 10.5.7 due to '@' in ls output (original) (raw)

I am testing this out of the trunk on OS X 10.5.7:

uclid:trunk minge$ uname -a Darwin euclid.local 9.7.0 Darwin Kernel Version 9.7.0: Tue Mar 31 22:52:17 PDT 2009; root:xnu-1228.12.14~1/RELEASE_I386 i386 euclid:trunk minge$ ./python.exe Lib/test/test_commands.py test_getoutput (main.CommandTests) ... ok test_getstatus (main.CommandTests) ... FAIL

====================================================================== FAIL: test_getstatus (main.CommandTests)

Traceback (most recent call last): File "Lib/test/test_commands.py", line 60, in test_getstatus self.assertTrue(re.match(pat, getstatus("/."), re.VERBOSE)) AssertionError: None is not True


Ran 2 tests in 0.047s

FAILED (failures=1) Traceback (most recent call last): File "Lib/test/test_commands.py", line 69, in test_main() File "Lib/test/test_commands.py", line 64, in test_main run_unittest(CommandTests) File "/Users/minge/Research/Languages/python/trunk/Lib/test/test_support.py", line 884, in run_unittest _run_suite(suite) File "/Users/minge/Research/Languages/python/trunk/Lib/test/test_support.py", line 867, in _run_suite raise TestFailed(err) test.test_support.TestFailed: Traceback (most recent call last): File "Lib/test/test_commands.py", line 60, in test_getstatus self.assertTrue(re.match(pat, getstatus("/."), re.VERBOSE)) AssertionError: None is not True

[30608 refs] euclid:trunk minge$ patch -p0 < test_commands.patch patching file Lib/test/test_commands.py euclid:trunk minge$ ./python.exe Lib/test/test_commands.py test_getoutput (main.CommandTests) ... ok test_getstatus (main.CommandTests) ... ok


Ran 2 tests in 0.040s

OK [30459 refs]

According to the OS X documentation for ls(1) [1] the output of ls can include the '@' character to denote that file has "extended attributes". The attached patch adjust the regex which is applied to the output of ls to account for this fact (a more rigorous approach would have conditioned the '@' check on OS X, but I wasn't sure if it was worth the added complexity).

[1] http://developer.apple.com/mac/library/DOCUMENTATION/Darwin/Reference/ManPages/man1/ls.1.html

test_commands test_getstatus also fails on linux with SELinux enabled

On gnu/linux, info ls reports: """ Following the file mode bits is a single character that specifies whether an alternate access method such as an access control list applies to the file. When the character following the file mode bits is a space, there is no alternate access method. When it is a printing character, then there is such a method.

 GNU `ls' uses a `.' character to indicate a file with an SELinux
 security context, but no other alternate access method.

 A file with any other combination of alternate access methods is
 marked with a `+' character.

"""

So it sounds like the previous patch could be further generalized to (say) """

or metadata ('@' OS X). """

~jim