Revision: 2937
Author: pekka.klarck
Date: Mon Apr 12 06:38:30 2010
Log: workaround for jython os.listdir bug (issue 530)
http://code.google.com/p/robotframework/source/detail?r=2937

Modified:
 /trunk/src/robot/parsing/model.py

=======================================
--- /trunk/src/robot/parsing/model.py   Wed Mar 31 09:00:56 2010
+++ /trunk/src/robot/parsing/model.py   Mon Apr 12 06:38:30 2010
@@ -133,8 +133,7 @@
         return utils.get_directory(path)

     def _get_suite_items(self, dirpath, suitenames):
-        names = os.listdir(dirpath)
-        names.sort(lambda x,y: cmp(x.lower(), y.lower()))
+        names = self._list_dir(dirpath)
         files = []
         initfile = None
         for name in names:
@@ -150,6 +149,15 @@
                 files.append(path)
         return files, initfile

+    def _list_dir(self, path):
+        names = os.listdir(path)
+        if utils.is_jython:
+            # http://bugs.jython.org/issue1593
+            from java.lang import String
+            names = [ utils.unic(String(n)) for n in names ]
+        names.sort(lambda x,y: cmp(x.lower(), y.lower()))
+        return names
+
     def _get_rawdata(self, path):
         if self.initfile is None:
             LOGGER.info("No test suite directory init file")

Reply via email to