예제 #1
0
    def startTest(self, test):
        """
        When preparing test, check whether to make our database fresh
        """

        from django.conf import settings
        
        test_case = get_test_case_class(test)

        enable_test(test_case, 'selenium_plugin_started')
        
        if getattr(test_case, "selenium_start", False):
            sel = selenium(
                      getattr(settings, "SELENIUM_HOST", 'localhost'),
                      int(getattr(settings, "SELENIUM_PORT", 4444)),
                      getattr(settings, "SELENIUM_BROWSER_COMMAND", '*opera'),
                      getattr(settings, "SELENIUM_URL_ROOT", get_live_server_path()),
                  )
            try:
                sel.start()
                test_case.selenium_started = True
            except Exception, err:
                # we must catch it all as there is untyped socket exception on Windows :-]]]
                if getattr(settings, "FORCE_SELENIUM_TESTS", False):
                    raise
                else:
                    test_case.skipped = True
                    #raise SkipTest(err)
            else:
                if isinstance(test.test, nose.case.MethodTestCase):
                    test.test.test.im_self.selenium = sel
                else:
                    test_case.skipped = True
예제 #2
0
    def startTest(self, test):
        """
        When preparing test, check whether to make our database fresh
        """

        from django.conf import settings

        test_case = get_test_case_class(test)

        enable_test(test_case, 'selenium_plugin_started')

        if getattr(test_case, "selenium_start", False):
            sel = selenium(
                getattr(settings, "SELENIUM_HOST", 'localhost'),
                int(getattr(settings, "SELENIUM_PORT", 4444)),
                getattr(settings, "SELENIUM_BROWSER_COMMAND", '*opera'),
                getattr(settings, "SELENIUM_URL_ROOT", get_live_server_path()),
            )
            try:
                sel.start()
                test_case.selenium_started = True
            except Exception, err:
                # we must catch it all as there is untyped socket exception on Windows :-]]]
                if getattr(settings, "FORCE_SELENIUM_TESTS", False):
                    raise
                else:
                    test_case.skipped = True
                    #raise SkipTest(err)
            else:
                if isinstance(test.test, nose.case.MethodTestCase):
                    test.test.test.im_self.selenium = sel
                else:
예제 #3
0
    def startTest(self, test):
        """
        When preparing test, check whether to make our database fresh
        """

        from django.conf import settings
        from django.utils.importlib import import_module

        test_case = get_test_case_class(test)

        enable_test(test_case, 'selenium_plugin_started')

        # import selenium class to use
        selenium_import = getattr(settings, "DST_SELENIUM_DRIVER",
                            "djangosanetesting.selenium.driver.selenium").split(".")
        selenium_module, selenium_cls = ".".join(selenium_import[:-1]), selenium_import[-1]
        selenium = getattr(import_module(selenium_module), selenium_cls)
        
        if getattr(test_case, "selenium_start", False):
            browser = getattr(test_case, 'selenium_browser_command', None)
            if browser is None:
                browser = getattr(settings, "SELENIUM_BROWSER_COMMAND", '*opera')

            sel = selenium(
                      getattr(settings, "SELENIUM_HOST", 'localhost'),
                      int(getattr(settings, "SELENIUM_PORT", 4444)),
                      browser,
                      getattr(settings, "SELENIUM_URL_ROOT", get_live_server_path()),
                  )
            try:
                sel.start()
                test_case.selenium_started = True
            except Exception, err:
                # we must catch it all as there is untyped socket exception on Windows :-]]]
                if getattr(settings, "FORCE_SELENIUM_TESTS", False):
                    raise
                else:
                    test_case.skipped = True
                    #raise SkipTest(err)
            else:
                if isinstance(test.test, nose.case.MethodTestCase):
                    test.test.test.im_self.selenium = sel
                else:
                    test_case.skipped = True
예제 #4
0
    def startTest(self, test):
        """
        When preparing test, check whether to make our database fresh
        """

        from django.conf import settings
        from django.utils.importlib import import_module

        test_case = get_test_case_class(test)

        enable_test(test_case, 'selenium_plugin_started')

        # import selenium class to use
        selenium_import = getattr(
            settings, "DST_SELENIUM_DRIVER",
            "djangosanetesting.selenium.driver.selenium").split(".")
        selenium_module, selenium_cls = ".".join(
            selenium_import[:-1]), selenium_import[-1]
        selenium = getattr(import_module(selenium_module), selenium_cls)

        if getattr(test_case, "selenium_start", False):
            sel = selenium(
                getattr(settings, "SELENIUM_HOST", 'localhost'),
                int(getattr(settings, "SELENIUM_PORT", 4444)),
                getattr(settings, "SELENIUM_BROWSER_COMMAND", '*opera'),
                getattr(settings, "SELENIUM_URL_ROOT", get_live_server_path()),
            )
            try:
                sel.start()
                test_case.selenium_started = True
            except Exception, err:
                # we must catch it all as there is untyped socket exception on Windows :-]]]
                if getattr(settings, "FORCE_SELENIUM_TESTS", False):
                    raise
                else:
                    test_case.skipped = True
                    #raise SkipTest(err)
            else:
                if isinstance(test.test, nose.case.MethodTestCase):
                    test.test.test.im_self.selenium = sel
                else: