[windmill] initialize windmill registry if not already existing (possible error case in dev) stable
authorJulien Jehannet <julien.jehannet@logilab.fr>
Thu, 23 Sep 2010 15:30:54 +0200
branchstable
changeset 6322 711e7e8c69e3
parent 6321 a8a33679f4dd
child 6323 a11c1e3c16c3
[windmill] initialize windmill registry if not already existing (possible error case in dev)
devtools/cwwindmill.py
devtools/httptest.py
--- a/devtools/cwwindmill.py	Thu Sep 23 12:16:36 2010 +0200
+++ b/devtools/cwwindmill.py	Thu Sep 23 15:30:54 2010 +0200
@@ -31,6 +31,7 @@
 # imported by default to simplify further import statements
 from logilab.common.testlib import unittest_main
 
+import windmill
 from windmill.dep import functest
 
 from cubicweb.devtools.httptest import CubicWebServerTC
@@ -46,7 +47,6 @@
 
 class WindmillUnitTestCase(unittest.TestCase):
     def setUp(self):
-        import windmill
         windmill.stdout, windmill.stdin = sys.stdout, sys.stdin
         from windmill.bin.admin_lib import configure_global_settings, setup
         configure_global_settings()
@@ -90,12 +90,11 @@
     def testWindmill(self):
         if self.edit_test:
             # see windmill.bin.admin_options.Firebug
-            import windmill
             windmill.settings['INSTALL_FIREBUG'] = 'firebug'
-            windmill.settings['MOZILLA_PLUGINS'].append('/usr/share/mozilla-extensions/')
-            windmill.settings['MOZILLA_PLUGINS'].append('/usr/share/xul-ext/')
-
-        self.windmill_shell_objects['start_' + self.browser]()
+            windmill.settings.setdefault('MOZILLA_PLUGINS', []).extend(
+                '/usr/share/mozilla-extensions/',
+                '/usr/share/xul-ext/')
+        controller = self.windmill_shell_objects['start_' + self.browser]()
         self.windmill_shell_objects['do_test'](self.test_dir,
                                                load=self.edit_test,
                                                threaded=False)
@@ -104,6 +103,7 @@
             import pdb; pdb.set_trace()
             return
 
+        # reporter
         for test in unittestreporter.test_list:
             msg = ""
             self._testMethodDoc = getattr(test, "__doc__", None)
--- a/devtools/httptest.py	Thu Sep 23 12:16:36 2010 +0200
+++ b/devtools/httptest.py	Thu Sep 23 15:30:54 2010 +0200
@@ -55,6 +55,7 @@
             s.close()
     raise RuntimeError('get_available_port([ports_range]) cannot find an available port')
 
+
 class CubicWebServerTC(CubicWebTC):
     """basic class for running test server