Author: reebalazs
Date: Sun Dec 30 17:43:19 2007
New Revision: 50207

Modified:
   kukit/kss.demo/branch/finish-closures/kss/demo/browser/registry.py
   kukit/kss.demo/branch/finish-closures/kss/demo/registry.py
   kukit/kss.demo/branch/finish-closures/kss/demo/selenium_utils/builder.py
Log:
Make alphabetical ordering of selenium tests in their plugin, this will assure 
that 0_ecmatest.html will come first.

Modified: kukit/kss.demo/branch/finish-closures/kss/demo/browser/registry.py
==============================================================================
--- kukit/kss.demo/branch/finish-closures/kss/demo/browser/registry.py  
(original)
+++ kukit/kss.demo/branch/finish-closures/kss/demo/browser/registry.py  Sun Dec 
30 17:43:19 2007
@@ -64,6 +64,12 @@
         elif filename.lower().endswith('.htm'):
             filename = filename[:-4]
         words = os.path.basename(filename).split('_')
+        # if the first word is a number: it is ignored in the title
+        # This can be used to somelimited ordering, since filenames
+        # are listed in alphabetical order, ie. 00_xxx.html will come first.
+        if not words[0] or '0' <= words[0][0] <= '9':
+            words = words[1:]
+        # Compile the result.
         result = ' '.join([word.capitalize() for word in words])
         return result
 

Modified: kukit/kss.demo/branch/finish-closures/kss/demo/registry.py
==============================================================================
--- kukit/kss.demo/branch/finish-closures/kss/demo/registry.py  (original)
+++ kukit/kss.demo/branch/finish-closures/kss/demo/registry.py  Sun Dec 30 
17:43:19 2007
@@ -140,7 +140,10 @@
     def registerSeleniumTestsFromPlugin(self, plugin, registration=None, 
event=None, new_event=None):
         """Add a demo collection to the registry.
         """
-        for test_filename in self._getSeleniumTestsFromPlugin(plugin):
+        test_filenames = self._getSeleniumTestsFromPlugin(plugin)
+        # Sort filenames alphabetically
+        test_filenames.sort()
+        for test_filename in test_filenames:
             self.registerSeleniumTestFile(test_filename)
 
     @adapter(IKSSSeleniumTestResource, IUtilityRegistration, IUnregistered, 
IKSSDemoRegistrationEvent)
@@ -153,6 +156,7 @@
     def registerSeleniumTestFile(self, test_filename):
         """Register a selenium test by absolute filename
         """
+        print "-----", test_filename
         if test_filename in self.selenium_tests:
             raise Exception, 'The selenium test for %s has already been 
registered. Cannot add.' % (test_filename, )
         self.selenium_tests.append(test_filename)

Modified: 
kukit/kss.demo/branch/finish-closures/kss/demo/selenium_utils/builder.py
==============================================================================
--- kukit/kss.demo/branch/finish-closures/kss/demo/selenium_utils/builder.py    
(original)
+++ kukit/kss.demo/branch/finish-closures/kss/demo/selenium_utils/builder.py    
Sun Dec 30 17:43:19 2007
@@ -31,7 +31,11 @@
     for test_filename in os.listdir(tests_root_dir):
         if test_filename.lower().endswith('.html') or \
                 test_filename.endswith('.htm'):
-            test_filenames.append(os.path.join(tests_root_dir, test_filename))
+            test_filenames.append((test_filename, os.path.join(tests_root_dir, 
test_filename)))
+    # sort the testfilenames
+    test_filenames.sort()
+    # return only the absolute filenames
+    test_filenames = [filename[1] for filename in test_filenames]
     return test_filenames
 
 template = Template(textwrap.dedent('''\
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins

Reply via email to