]> granicus.if.org Git - python/commitdiff
Make test_commands work on more systems. This removes much of the dependency
authorFred Drake <fdrake@acm.org>
Mon, 1 Apr 2002 23:56:03 +0000 (23:56 +0000)
committerFred Drake <fdrake@acm.org>
Mon, 1 Apr 2002 23:56:03 +0000 (23:56 +0000)
on how a system is configured.
This closes SF bug #497160 (which has the patch) and #460613.

Bugfix candidate.

Lib/test/test_commands.py

index 1cd8b8b59cfd86fe1e275eac4b9ed11fb6b7d25a..aadd419a8a6bc4f233d4a0b99c7eb1b64cf5d866 100644 (file)
@@ -30,17 +30,18 @@ class CommandTests(unittest.TestCase):
         self.assertNotEquals(status, 0)
 
     def test_getstatus(self):
-        # This pattern should match 'ls -ld /bin/ls' on any posix
+        # This pattern should match 'ls -ld /.' on any posix
         # system, however perversely configured.
-        pat = r'''[l-]..x..x..x # It is executable. (May be a symlink.)
+        pat = r'''d.........   # It is a directory.
                   \s+\d+       # It has some number of links.
                   \s+\w+\s+\w+ # It has a user and group, which may
                                #     be named anything.
+                  \s+\d+       # It has a size.
                   [^/]*        # Skip the date.
-                  /bin/ls      # and end with the name of the file.
+                  /.           # and end with the name of the file.
                '''
 
-        self.assert_(re.match(pat, getstatus("/bin/ls"), re.VERBOSE))
+        self.assert_(re.match(pat, getstatus("/."), re.VERBOSE))
 
 
 def test_main():