def __call__(self, parser, namespace, values, option_string=None):
     browsers = values.split(",")
     for browser in browsers:
         try:
             SeleniumTestCaseBase.import_webdriver(browser)
         except ImportError:
             raise argparse.ArgumentError(self, "Selenium browser specification '%s' is not valid." % browser)
     setattr(namespace, self.dest, browsers)
Beispiel #2
0
 def __call__(self, parser, namespace, values, option_string=None):
     browsers = values.split(',')
     for browser in browsers:
         try:
             SeleniumTestCaseBase.import_webdriver(browser)
         except ImportError:
             raise argparse.ArgumentError(
                 self, "Selenium browser specification '%s' is not valid." %
                 browser)
     setattr(namespace, self.dest, browsers)
Beispiel #3
0
    options = parser.parse_args()

    # Allow including a trailing slash on app_labels for tab completion convenience
    options.modules = [os.path.normpath(labels) for labels in options.modules]

    if options.settings:
        os.environ['DJANGO_SETTINGS_MODULE'] = options.settings
    else:
        if "DJANGO_SETTINGS_MODULE" not in os.environ:
            os.environ[
                'DJANGO_SETTINGS_MODULE'] = 'nested_admin.tests.settings'
        options.settings = os.environ['DJANGO_SETTINGS_MODULE']

    if options.liveserver is not None:
        os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] = options.liveserver

    if options.selenium:
        SeleniumTestCaseBase.browsers = options.selenium
    else:
        SeleniumTestCaseBase.import_webdriver('phantomjs')
        SeleniumTestCaseBase.browsers = ['phantomjs']

    os.environ.setdefault('NESTED_ADMIN_LOG_LEVEL',
                          ['ERROR', 'WARNING', 'INFO',
                           'DEBUG'][options.verbosity])

    failures = django_tests(options.verbosity, options.failfast,
                            options.modules)
    if failures:
        sys.exit(bool(failures))
        metavar="BROWSERS",
        help="A comma-separated list of browsers to run the Selenium tests against. " 'Defaults to "phantomjs".',
    )

    options = parser.parse_args()

    # Allow including a trailing slash on app_labels for tab completion convenience
    options.modules = [os.path.normpath(labels) for labels in options.modules]

    if options.settings:
        os.environ["DJANGO_SETTINGS_MODULE"] = options.settings
    else:
        if "DJANGO_SETTINGS_MODULE" not in os.environ:
            os.environ["DJANGO_SETTINGS_MODULE"] = "nested_admin.tests.settings"
        options.settings = os.environ["DJANGO_SETTINGS_MODULE"]

    if options.liveserver is not None:
        os.environ["DJANGO_LIVE_TEST_SERVER_ADDRESS"] = options.liveserver

    if options.selenium:
        SeleniumTestCaseBase.browsers = options.selenium
    else:
        SeleniumTestCaseBase.import_webdriver("phantomjs")
        SeleniumTestCaseBase.browsers = ["phantomjs"]

    os.environ.setdefault("NESTED_ADMIN_LOG_LEVEL", ["ERROR", "WARNING", "INFO", "DEBUG"][options.verbosity])

    failures = django_tests(options.verbosity, options.failfast, options.modules)
    if failures:
        sys.exit(bool(failures))
        help='A comma-separated list of browsers to run the Selenium tests against. '
             'Defaults to "phantomjs".')

    options = parser.parse_args()

    # Allow including a trailing slash on app_labels for tab completion convenience
    options.modules = [os.path.normpath(labels) for labels in options.modules]

    if options.settings:
        os.environ['DJANGO_SETTINGS_MODULE'] = options.settings
    else:
        if "DJANGO_SETTINGS_MODULE" not in os.environ:
            os.environ['DJANGO_SETTINGS_MODULE'] = 'nested_admin.tests.settings'
        options.settings = os.environ['DJANGO_SETTINGS_MODULE']

    if options.liveserver is not None:
        os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] = options.liveserver

    if options.selenium:
        SeleniumTestCaseBase.browsers = options.selenium
    else:
        SeleniumTestCaseBase.import_webdriver('phantomjs')
        SeleniumTestCaseBase.browsers = ['phantomjs']

    os.environ.setdefault('NESTED_ADMIN_LOG_LEVEL',
        ['ERROR', 'WARNING', 'INFO', 'DEBUG'][options.verbosity])

    failures = django_tests(options.verbosity, options.failfast, options.modules)
    if failures:
        sys.exit(bool(failures))