summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/contrib/admin/tests.py3
-rw-r--r--docs/internals/contributing/writing-code/unit-tests.txt3
-rwxr-xr-xtests/runtests.py4
-rw-r--r--tests/view_tests/tests/test_i18n.py3
4 files changed, 11 insertions, 2 deletions
diff --git a/django/contrib/admin/tests.py b/django/contrib/admin/tests.py
index f234fc2393..25610eb173 100644
--- a/django/contrib/admin/tests.py
+++ b/django/contrib/admin/tests.py
@@ -2,7 +2,7 @@ import os
from unittest import SkipTest
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
-from django.test import modify_settings
+from django.test import modify_settings, tag
from django.utils.module_loading import import_string
from django.utils.translation import ugettext as _
@@ -14,6 +14,7 @@ class CSPMiddleware(object):
return response
+@tag('selenium')
@modify_settings(
MIDDLEWARE_CLASSES={'append': 'django.contrib.admin.tests.CSPMiddleware'},
)
diff --git a/docs/internals/contributing/writing-code/unit-tests.txt b/docs/internals/contributing/writing-code/unit-tests.txt
index 1de6caacb5..8ed2154939 100644
--- a/docs/internals/contributing/writing-code/unit-tests.txt
+++ b/docs/internals/contributing/writing-code/unit-tests.txt
@@ -128,6 +128,9 @@ install the selenium_ package into your Python path and run the tests with the
$ ./runtests.py --settings=test_sqlite --selenium admin_inlines
+Specifying ``--selenium`` automatically sets ``--tags=selenium`` to run only
+the tests that require selenium.
+
.. _running-unit-tests-dependencies:
Running all the tests
diff --git a/tests/runtests.py b/tests/runtests.py
index 6fca3dc6a6..b14bc76ed7 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -439,6 +439,10 @@ if __name__ == "__main__":
if options.selenium:
os.environ['DJANGO_SELENIUM_TESTS'] = '1'
+ if not options.tags:
+ options.tags = ['selenium']
+ elif 'selenium' not in options.tags:
+ options.tags.append('selenium')
if options.bisect:
bisect_tests(options.bisect, options, options.modules, options.parallel)
diff --git a/tests/view_tests/tests/test_i18n.py b/tests/view_tests/tests/test_i18n.py
index 269a7d7075..c342c85803 100644
--- a/tests/view_tests/tests/test_i18n.py
+++ b/tests/view_tests/tests/test_i18n.py
@@ -10,7 +10,7 @@ from os import path
from django.conf import settings
from django.test import (
LiveServerTestCase, SimpleTestCase, TestCase, modify_settings,
- override_settings,
+ override_settings, tag,
)
from django.urls import reverse
from django.utils import six
@@ -260,6 +260,7 @@ skip_selenium = not os.environ.get('DJANGO_SELENIUM_TESTS', False)
@unittest.skipIf(skip_selenium, 'Selenium tests not requested')
+@tag('selenium')
@override_settings(ROOT_URLCONF='view_tests.urls')
class JavascriptI18nTests(LiveServerTestCase):