Skip to content

Commit

Permalink
Fixed #25653 -- Made --selenium run only the selenium tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
akki authored and timgraham committed Feb 19, 2016
1 parent 032f5a7 commit 6670da7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion django/contrib/admin/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
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 _

Expand All @@ -14,6 +14,7 @@ def process_response(self, request, response):
return response


@tag('selenium')
@modify_settings(
MIDDLEWARE_CLASSES={'append': 'django.contrib.admin.tests.CSPMiddleware'},
)
Expand Down
3 changes: 3 additions & 0 deletions docs/internals/contributing/writing-code/unit-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions tests/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,10 @@ def paired_tests(paired_test, options, test_labels, parallel):

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)
Expand Down
3 changes: 2 additions & 1 deletion tests/view_tests/tests/test_i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
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
Expand Down Expand Up @@ -260,6 +260,7 @@ def test_i18n_with_locale_paths(self):


@unittest.skipIf(skip_selenium, 'Selenium tests not requested')
@tag('selenium')
@override_settings(ROOT_URLCONF='view_tests.urls')
class JavascriptI18nTests(LiveServerTestCase):

Expand Down

0 comments on commit 6670da7

Please sign in to comment.