Kaydet (Commit) 6670da75 authored tarafından Akshesh's avatar Akshesh Kaydeden (comit) Tim Graham

Fixed #25653 -- Made --selenium run only the selenium tests.

üst 032f5a78
...@@ -2,7 +2,7 @@ import os ...@@ -2,7 +2,7 @@ import os
from unittest import SkipTest from unittest import SkipTest
from django.contrib.staticfiles.testing import StaticLiveServerTestCase 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.module_loading import import_string
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
...@@ -14,6 +14,7 @@ class CSPMiddleware(object): ...@@ -14,6 +14,7 @@ class CSPMiddleware(object):
return response return response
@tag('selenium')
@modify_settings( @modify_settings(
MIDDLEWARE_CLASSES={'append': 'django.contrib.admin.tests.CSPMiddleware'}, MIDDLEWARE_CLASSES={'append': 'django.contrib.admin.tests.CSPMiddleware'},
) )
......
...@@ -128,6 +128,9 @@ install the selenium_ package into your Python path and run the tests with the ...@@ -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 $ ./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-unit-tests-dependencies:
Running all the tests Running all the tests
......
...@@ -439,6 +439,10 @@ if __name__ == "__main__": ...@@ -439,6 +439,10 @@ if __name__ == "__main__":
if options.selenium: if options.selenium:
os.environ['DJANGO_SELENIUM_TESTS'] = '1' 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: if options.bisect:
bisect_tests(options.bisect, options, options.modules, options.parallel) bisect_tests(options.bisect, options, options.modules, options.parallel)
......
...@@ -10,7 +10,7 @@ from os import path ...@@ -10,7 +10,7 @@ from os import path
from django.conf import settings from django.conf import settings
from django.test import ( from django.test import (
LiveServerTestCase, SimpleTestCase, TestCase, modify_settings, LiveServerTestCase, SimpleTestCase, TestCase, modify_settings,
override_settings, override_settings, tag,
) )
from django.urls import reverse from django.urls import reverse
from django.utils import six from django.utils import six
...@@ -260,6 +260,7 @@ skip_selenium = not os.environ.get('DJANGO_SELENIUM_TESTS', False) ...@@ -260,6 +260,7 @@ skip_selenium = not os.environ.get('DJANGO_SELENIUM_TESTS', False)
@unittest.skipIf(skip_selenium, 'Selenium tests not requested') @unittest.skipIf(skip_selenium, 'Selenium tests not requested')
@tag('selenium')
@override_settings(ROOT_URLCONF='view_tests.urls') @override_settings(ROOT_URLCONF='view_tests.urls')
class JavascriptI18nTests(LiveServerTestCase): class JavascriptI18nTests(LiveServerTestCase):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment