mirror of https://github.com/django/django.git
Fixed #33455 -- Improved error message when selenium is not installed.
This commit is contained in:
parent
2d8232fa71
commit
9dc65263d4
|
@ -21,6 +21,7 @@ except ImportError as e:
|
||||||
else:
|
else:
|
||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.db import connection, connections
|
from django.db import connection, connections
|
||||||
from django.test import TestCase, TransactionTestCase
|
from django.test import TestCase, TransactionTestCase
|
||||||
from django.test.runner import get_max_test_processes, parallel_type
|
from django.test.runner import get_max_test_processes, parallel_type
|
||||||
|
@ -321,6 +322,10 @@ class ActionSelenium(argparse.Action):
|
||||||
Validate the comma-separated list of requested browsers.
|
Validate the comma-separated list of requested browsers.
|
||||||
"""
|
"""
|
||||||
def __call__(self, parser, namespace, values, option_string=None):
|
def __call__(self, parser, namespace, values, option_string=None):
|
||||||
|
try:
|
||||||
|
import selenium # NOQA
|
||||||
|
except ImportError as e:
|
||||||
|
raise ImproperlyConfigured(f'Error loading selenium module: {e}')
|
||||||
browsers = values.split(',')
|
browsers = values.split(',')
|
||||||
for browser in browsers:
|
for browser in browsers:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue