Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit 906dc8522a1745e0e12c8061e4170540f7d0f486 1 parent 6d52bcb
Carl Meyer authored February 25, 2013
4  django/contrib/admin/tests.py
@@ -10,8 +10,8 @@ class AdminSeleniumWebDriverTestCase(LiveServerTestCase):
10 10
 
11 11
     @classmethod
12 12
     def setUpClass(cls):
13  
-        if os.environ.get('DJANGO_SKIP_SELENIUM_TESTS', False):
14  
-            raise SkipTest('Selenium tests skipped by explicit request')
  13
+        if not os.environ.get('DJANGO_SELENIUM_TESTS', False):
  14
+            raise SkipTest('Selenium tests not requested')
15 15
         try:
16 16
             cls.selenium = import_by_path(cls.webdriver_class)()
17 17
         except Exception as e:
15  docs/internals/contributing/writing-code/unit-tests.txt
@@ -128,21 +128,12 @@ Running the Selenium tests
128 128
 
129 129
 Some admin tests require Selenium 2, Firefox and Python >= 2.6 to work via a
130 130
 real Web browser. To allow those tests to run and not be skipped, you must
131  
-install the selenium_ package (version > 2.13) into your Python path.
132  
-
133  
-Then, run the tests normally, for example:
134  
-
135  
-.. code-block:: bash
136  
-
137  
-    ./runtests.py --settings=test_sqlite admin_inlines
138  
-
139  
-If you have Selenium installed but for some reason don't want to run these tests
140  
-(for example to speed up the test suite), use the ``--skip-selenium`` option
141  
-of the test runner.
  131
+install the selenium_ package (version > 2.13) into your Python path and run
  132
+the tests with the ``--selenium`` option:
142 133
 
143 134
 .. code-block:: bash
144 135
 
145  
-    ./runtests.py --settings=test_sqlite --skip-selenium admin_inlines
  136
+    ./runtests.py --settings=test_sqlite --selenium admin_inlines
146 137
 
147 138
 
148 139
 .. _running-unit-tests-dependencies:
4  tests/regressiontests/views/tests/i18n.py
@@ -177,10 +177,10 @@ def testI18NWithLocalePaths(self):
177 177
                     javascript_quote('este texto de app3 debe ser traducido'))
178 178
 
179 179
 
180  
-skip_selenium = os.environ.get('DJANGO_SKIP_SELENIUM_TESTS', False)
  180
+skip_selenium = not os.environ.get('DJANGO_SELENIUM_TESTS', False)
181 181
 
182 182
 
183  
-@unittest.skipIf(skip_selenium, 'Selenium tests skipped by explicit request')
  183
+@unittest.skipIf(skip_selenium, 'Selenium tests not requested')
184 184
 @unittest.skipUnless(firefox, 'Selenium not installed')
185 185
 class JavascriptI18nTests(LiveServerTestCase):
186 186
     urls = 'regressiontests.views.urls'
9  tests/runtests.py
@@ -302,10 +302,9 @@ def paired_tests(paired_test, options, test_labels):
302 302
              'LiveServerTestCase) is expected to run from. The default value '
303 303
              'is localhost:8081.')
304 304
     parser.add_option(
305  
-        '--skip-selenium', action='store_true', dest='skip_selenium',
  305
+        '--selenium', action='store_true', dest='selenium',
306 306
         default=False,
307  
-        help='Skip running Selenium tests even it Selenium itself is '
308  
-             'installed. By default these tests are not skipped.')
  307
+        help='Run the Selenium tests as well (if Selenium is installed)')
309 308
     options, args = parser.parse_args()
310 309
     if options.settings:
311 310
         os.environ['DJANGO_SETTINGS_MODULE'] = options.settings
@@ -318,8 +317,8 @@ def paired_tests(paired_test, options, test_labels):
318 317
     if options.liveserver is not None:
319 318
         os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] = options.liveserver
320 319
 
321  
-    if options.skip_selenium:
322  
-        os.environ['DJANGO_SKIP_SELENIUM_TESTS'] = '1'
  320
+    if options.selenium:
  321
+        os.environ['DJANGO_SELENIUM_TESTS'] = '1'
323 322
 
324 323
     if options.bisect:
325 324
         bisect_tests(options.bisect, options, args)

0 notes on commit 906dc85

Please sign in to comment.
Something went wrong with that request. Please try again.