1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Fixed #19854 -- Turn Django's own Selenium tests off by default.

This commit is contained in:
Carl Meyer 2013-02-25 10:14:42 -07:00
parent 6d52bcbb7c
commit 906dc8522a
4 changed files with 11 additions and 21 deletions

View File

@ -10,8 +10,8 @@ class AdminSeleniumWebDriverTestCase(LiveServerTestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
if os.environ.get('DJANGO_SKIP_SELENIUM_TESTS', False): if not os.environ.get('DJANGO_SELENIUM_TESTS', False):
raise SkipTest('Selenium tests skipped by explicit request') raise SkipTest('Selenium tests not requested')
try: try:
cls.selenium = import_by_path(cls.webdriver_class)() cls.selenium = import_by_path(cls.webdriver_class)()
except Exception as e: except Exception as e:

View File

@ -128,21 +128,12 @@ Running the Selenium tests
Some admin tests require Selenium 2, Firefox and Python >= 2.6 to work via a Some admin tests require Selenium 2, Firefox and Python >= 2.6 to work via a
real Web browser. To allow those tests to run and not be skipped, you must real Web browser. To allow those tests to run and not be skipped, you must
install the selenium_ package (version > 2.13) into your Python path. install the selenium_ package (version > 2.13) into your Python path and run
the tests with the ``--selenium`` option:
Then, run the tests normally, for example:
.. code-block:: bash .. code-block:: bash
./runtests.py --settings=test_sqlite admin_inlines ./runtests.py --settings=test_sqlite --selenium admin_inlines
If you have Selenium installed but for some reason don't want to run these tests
(for example to speed up the test suite), use the ``--skip-selenium`` option
of the test runner.
.. code-block:: bash
./runtests.py --settings=test_sqlite --skip-selenium admin_inlines
.. _running-unit-tests-dependencies: .. _running-unit-tests-dependencies:

View File

@ -177,10 +177,10 @@ class JsI18NTestsMultiPackage(TestCase):
javascript_quote('este texto de app3 debe ser traducido')) javascript_quote('este texto de app3 debe ser traducido'))
skip_selenium = os.environ.get('DJANGO_SKIP_SELENIUM_TESTS', False) skip_selenium = not os.environ.get('DJANGO_SELENIUM_TESTS', False)
@unittest.skipIf(skip_selenium, 'Selenium tests skipped by explicit request') @unittest.skipIf(skip_selenium, 'Selenium tests not requested')
@unittest.skipUnless(firefox, 'Selenium not installed') @unittest.skipUnless(firefox, 'Selenium not installed')
class JavascriptI18nTests(LiveServerTestCase): class JavascriptI18nTests(LiveServerTestCase):
urls = 'regressiontests.views.urls' urls = 'regressiontests.views.urls'

View File

@ -302,10 +302,9 @@ if __name__ == "__main__":
'LiveServerTestCase) is expected to run from. The default value ' 'LiveServerTestCase) is expected to run from. The default value '
'is localhost:8081.') 'is localhost:8081.')
parser.add_option( parser.add_option(
'--skip-selenium', action='store_true', dest='skip_selenium', '--selenium', action='store_true', dest='selenium',
default=False, default=False,
help='Skip running Selenium tests even it Selenium itself is ' help='Run the Selenium tests as well (if Selenium is installed)')
'installed. By default these tests are not skipped.')
options, args = parser.parse_args() options, args = parser.parse_args()
if options.settings: if options.settings:
os.environ['DJANGO_SETTINGS_MODULE'] = options.settings os.environ['DJANGO_SETTINGS_MODULE'] = options.settings
@ -318,8 +317,8 @@ if __name__ == "__main__":
if options.liveserver is not None: if options.liveserver is not None:
os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] = options.liveserver os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] = options.liveserver
if options.skip_selenium: if options.selenium:
os.environ['DJANGO_SKIP_SELENIUM_TESTS'] = '1' os.environ['DJANGO_SELENIUM_TESTS'] = '1'
if options.bisect: if options.bisect:
bisect_tests(options.bisect, options, args) bisect_tests(options.bisect, options, args)