def setup_test_environment(self, **kwargs):
        #configure windmill
        admin_lib.configure_global_settings(logging_on=False)
        windmill.settings['shell_objects'] = self.windmill_cmds

        self.windmill_cmds['httpd'], self.windmill_cmds['httpd_thread'] = \
            admin_lib.run_threaded(windmill.settings['CONSOLE_LOG_LEVEL'])

        from windmill.bin import shell_objects
        for attribute in dir(shell_objects):
            self.windmill_cmds[attribute] = getattr(shell_objects, attribute)

        self.windmill_cmds['setup_has_run'] = True

        # firefox 4.0 compatibiliy hack
        if 'MOZILLA_DEFAULT_PROFILE' not in windmill.settings:
            tmp_profile = tempfile.mkdtemp(suffix='.mozrunner')
            windmill.settings['MOZILLA_DEFAULT_PROFILE'] = tmp_profile

        #run wsgi django server
        self.server_thread = TestServerThread(
            (self.test_server_host, self.test_server_port))
        self.server_thread.start()
        self.server_thread.started.wait()
        if self.server_thread.error:
            raise self.server_thread.error
Example #2
0
    def setup_test_environment(self, **kwargs):
        #configure windmill
        admin_lib.configure_global_settings(logging_on=False)
        windmill.settings['shell_objects'] = self.windmill_cmds
        
        self.windmill_cmds['httpd'], self.windmill_cmds['httpd_thread'] = \
            admin_lib.run_threaded(windmill.settings['CONSOLE_LOG_LEVEL'])

        from windmill.bin import shell_objects
        for attribute in dir(shell_objects):
            self.windmill_cmds[attribute] = getattr(shell_objects, attribute)

        self.windmill_cmds['setup_has_run'] = True

        # firefox 4.0 compatibiliy hack
        if 'MOZILLA_DEFAULT_PROFILE' not in windmill.settings:
            tmp_profile = tempfile.mkdtemp(suffix='.mozrunner')
            windmill.settings['MOZILLA_DEFAULT_PROFILE']= tmp_profile

        #run wsgi django server
        self.server_thread = TestServerThread((self.test_server_host, self.test_server_port))
        self.server_thread.start()
        self.server_thread.started.wait()
        if self.server_thread.error:
            raise self.server_thread.error
Example #3
0
def setup_module(module):
    """setup_module function for functest based python tests"""
    if not hasattr(windmill, 'settings'):
        admin_lib.configure_global_settings(logging_on=False)

    if not windmill.is_active:
        module.windmill_dict = admin_lib.setup()
    else:
        module.windmill_dict = admin_lib.shell_objects_dict
Example #4
0
def setup_module(module):
    """setup_module function for functest based python tests"""
    if not hasattr(windmill, 'settings'):
        admin_lib.configure_global_settings(logging_on=False)
        
    if not windmill.is_active:
        module.windmill_dict = admin_lib.setup()
    else:
        module.windmill_dict = admin_lib.shell_objects_dict
Example #5
0
def main():
    import windmill
    windmill.stdout, windmill.stdin = sys.stdout, sys.stdin
    from windmill.bin.admin_lib import configure_global_settings, setup
    configure_global_settings()
    shell_objects = setup()
    app = App(shell_objects=shell_objects)
    #shell_objects['wxwindmill_app'] = app
    app.MainLoop()
Example #6
0
def main():
    import windmill
    windmill.stdout, windmill.stdin = sys.stdout, sys.stdin
    from windmill.bin.admin_lib import configure_global_settings, setup
    configure_global_settings()
    shell_objects = setup()
    app = App(shell_objects=shell_objects)
    #shell_objects['wxwindmill_app'] = app
    app.MainLoop()
Example #7
0
File: unit.py Project: ept/windmill
 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()
     windmill.settings['TEST_URL'] = self.test_url
     if hasattr(self,"windmill_settings"):
         for (setting,value) in self.windmill_settings.iteritems():
             windmill.settings[setting] = value
     self.windmill_shell_objects = setup()
Example #8
0
 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()
     windmill.settings['TEST_URL'] = self.test_url
     if hasattr(self,"windmill_settings"):
         for (setting,value) in self.windmill_settings.iteritems():
             windmill.settings[setting] = value
     self.windmill_shell_objects = setup()
Example #9
0
  def handle(self, *args, **options):
    """
    This is a rewrite of windmill.management.commands.test_windmill
    that uses nose instead of functest.
    """
    from windmill.bin import admin_lib
    from windmill.conf import global_settings
    import nose

    self.port = options['port']

    # Setup DB
    self.setup_test_db()

    # Start a servers (django web server & Hadoop)
    server_container = ServerContainer()
    server_container.start_test_server()
    LOG.info("Server running on %d" % server_container.server_thread.port)
    self.start_helper_servers()


    # Configure windmill
    global_settings.TEST_URL = 'http://127.0.0.1:%d' % server_container.server_thread.port
    # For now, we only handle Firefox.
    global_settings.START_FIREFOX = True
    admin_lib.configure_global_settings(logging_on=False)

    # Start windmill proxy server
    windmill_obj = admin_lib.setup()

    # Run tests with nose
    nose_args = self.find_modules()
    LOG.info("Testing modules: " + repr(nose_args))
    if "--" in sys.argv:
      nose_args.extend(sys.argv[sys.argv.index("--") + 1:])
    res = nose.run(argv=nose_args)

    # Stop servers
    self.stop_helper_servers()
    server_container.stop_test_server()

    # Stop windmill
    admin_lib.teardown(windmill_obj)
    time.sleep(0.25)

    if res:
      sys.exit(0)
    else:
      sys.exit(1)
Example #10
0
  def handle(self, *args, **options):
    """
    This is a rewrite of windmill.management.commands.test_windmill
    that uses nose instead of functest.
    """
    from windmill.bin import admin_lib
    from windmill.conf import global_settings
    import nose

    self.port = options['port']

    # Setup DB
    self.setup_test_db()

    # Start a servers (django web server & Hadoop)
    server_container = ServerContainer()
    server_container.start_test_server()
    LOG.info("Server running on %d" % server_container.server_thread.port)
    self.start_helper_servers()


    # Configure windmill
    global_settings.TEST_URL = 'http://127.0.0.1:%d' % server_container.server_thread.port
    # For now, we only handle Firefox.
    global_settings.START_FIREFOX = True
    admin_lib.configure_global_settings(logging_on=False)

    # Start windmill proxy server
    windmill_obj = admin_lib.setup()

    # Run tests with nose
    nose_args = self.find_modules()
    LOG.info("Testing modules: " + repr(nose_args))
    if "--" in sys.argv:
      nose_args.extend(sys.argv[sys.argv.index("--") + 1:])
    res = nose.run(argv=nose_args)

    # Stop servers
    self.stop_helper_servers()
    server_container.stop_test_server()

    # Stop windmill
    admin_lib.teardown(windmill_obj)
    time.sleep(0.25)

    if res:
      sys.exit(0)
    else:
      sys.exit(1)
Example #11
0
    def initialize_windmill(self):
        if self.is_windmill_initialized():
            return
        self._windmill_initialized = True
        # global windmill setup
        # Code adapted from http://trac.getwindmill.com/browser/trunk/windmill/authoring/unit.py
        windmill.stdout = self.logfile
        windmill.stderr = self.logfile
        windmill.stdin = sys.stdin

        configure_global_settings(logging_on=False)
        windmill.settings['TEST_URL'] = self.url
        self.disable_windmill_console_log_spam()
        #windmill.settings['INSTALL_FIREBUG'] = 'firebug'

        # Then start windmill and the browser
        self.windmill_shell = setup()
        self.windmill_shell['start_' + self.windmill_browser]()
Example #12
0
 def initialize_windmill(self):
     if self.is_windmill_initialized():
         return
     self._windmill_initialized = True
     # global windmill setup
     # Code adapted from http://trac.getwindmill.com/browser/trunk/windmill/authoring/unit.py
     windmill.stdout = self.logfile
     windmill.stderr = self.logfile
     windmill.stdin = sys.stdin
     
     configure_global_settings(logging_on=False)
     windmill.settings['TEST_URL'] = self.url
     self.disable_windmill_console_log_spam()
     #windmill.settings['INSTALL_FIREBUG'] = 'firebug'
     
     # Then start windmill and the browser
     self.windmill_shell = setup()
     self.windmill_shell['start_'+self.windmill_browser]()
Example #13
0
    def setup_test_environment(self, **kwargs):
        #configure windmill
        admin_lib.configure_global_settings(logging_on=False)
        windmill.settings['shell_objects'] = self.windmill_cmds

        self.windmill_cmds['httpd'], self.windmill_cmds['httpd_thread'] = \
            admin_lib.run_threaded(windmill.settings['CONSOLE_LOG_LEVEL'])

        from windmill.bin import shell_objects
        for attribute in dir(shell_objects):
            self.windmill_cmds[attribute] = getattr(shell_objects, attribute)

        self.windmill_cmds['setup_has_run'] = True

        #run wsgi django server
        self.server_thread = TestServerThread((self.test_server_host, self.test_server_port))
        self.server_thread.start()
        self.server_thread.started.wait()
        if self.server_thread.error:
            raise self.server_thread.error
Example #14
0
    def setup_test_environment(self, **kwargs):
        #configure windmill
        admin_lib.configure_global_settings(logging_on=False)
        windmill.settings['shell_objects'] = self.windmill_cmds

        self.windmill_cmds['httpd'], self.windmill_cmds['httpd_thread'] = \
            admin_lib.run_threaded(windmill.settings['CONSOLE_LOG_LEVEL'])

        from windmill.bin import shell_objects
        for attribute in dir(shell_objects):
            self.windmill_cmds[attribute] = getattr(shell_objects, attribute)

        self.windmill_cmds['setup_has_run'] = True

        #run wsgi django server
        self.server_thread = TestServerThread(
            (self.test_server_host, self.test_server_port))
        self.server_thread.start()
        self.server_thread.started.wait()
        if self.server_thread.error:
            raise self.server_thread.error
Example #15
0
def setup_module(module):
    """setup_module function for functest based python tests"""
    if functest.registry.get('functest_cli', False):
        assert functest.registry.has_key('browser') # Make sure browser= was passed to functest
    
    import windmill
    if not hasattr(windmill, 'settings'):
        admin_lib.configure_global_settings(logging_on=False)
    
    if functest.registry.get('url', False):
        windmill.settings['TEST_URL'] = functest.registry['url']
    if functest.registry.get('functest_cli', False):
        windmill.settings['START_'+functest.registry.get('browser').upper()] = True
        
    if functest.registry.get('browser_debugging', False):
        WindmillTestClient.browser_debugging = True
        
    if not windmill.is_active:
        module.windmill_dict = admin_lib.setup()
    else:
        module.windmill_dict = admin_lib.shell_objects_dict
Example #16
0
def setup_module(module):
    """setup_module function for functest based python tests"""
    if functest.registry.get("functest_cli", False):
        assert functest.registry.has_key("browser")  # Make sure browser= was passed to functest

    import windmill

    if not hasattr(windmill, "settings"):
        admin_lib.configure_global_settings(logging_on=False)

    if functest.registry.get("url", False):
        windmill.settings["TEST_URL"] = functest.registry["url"]
    if functest.registry.get("functest_cli", False):
        windmill.settings["START_" + functest.registry.get("browser").upper()] = True

    if functest.registry.get("browser_debugging", False):
        WindmillTestClient.browser_debugging = True

    if not windmill.is_active:
        module.windmill_dict = admin_lib.setup()
    else:
        module.windmill_dict = admin_lib.shell_objects_dict
Example #17
0
def setup_module(module):
    """setup_module function for functest based python tests"""
    if functest.registry.get('functest_cli', False):
        assert functest.registry.has_key(
            'browser')  # Make sure browser= was passed to functest

    import windmill
    if not hasattr(windmill, 'settings'):
        admin_lib.configure_global_settings(logging_on=False)

    if functest.registry.get('url', False):
        windmill.settings['TEST_URL'] = functest.registry['url']
    if functest.registry.get('functest_cli', False):
        windmill.settings['START_' +
                          functest.registry.get('browser').upper()] = True

    if functest.registry.get('browser_debugging', False):
        WindmillTestClient.browser_debugging = True

    if not windmill.is_active:
        module.windmill_dict = admin_lib.setup()
    else:
        module.windmill_dict = admin_lib.shell_objects_dict