Browse Source

First positional argument for tox as test module/case path

Benjamin Bach 6 years ago
parent
commit
5b0f2e1a54
4 changed files with 15 additions and 2 deletions
  1. 1 0
      CHANGELOG.txt
  2. 12 1
      docs/contributing/developing.rst
  3. 1 0
      docs/releases/2.4.rst
  4. 1 1
      tox.ini

+ 1 - 0
CHANGELOG.txt

@@ -8,6 +8,7 @@ Changelog
  * Added `max_count` option on page models to limit the number of pages of a particular type that can be created (Dan Braghis)
  * Document and image choosers now show the document / image's collection (Alejandro Garza, Janneke Janssen)
  * Added new "Welcome to your Wagtail site" Starter Page when using wagtail start command (Timothy Allen, Scott Cranfill)
+ * Added ability to run individual tests through tox (Benjamin Bach)
  * Fix: Query objects returned from `PageQuerySet.type_q` can now be merged with `|` (Brady Moe)
  * Fix: Add `rel="noopener noreferrer"` to target blank links (Anselm Bradford)
  * Fix: Additional fields on custom document models now show on the multiple document upload view (Robert Rollins, Sergey Fedoseev)

+ 12 - 1
docs/contributing/developing.rst

@@ -68,19 +68,30 @@ From the root of the Wagtail codebase, run the following command to run all the
 
 At the time of writing, Wagtail has well over 2500 tests, which takes a while to
 run. You can run tests for only one part of Wagtail by passing in the path as
-an argument to ``runtests.py``:
+an argument to ``runtests.py`` or ``tox``:
 
 .. code-block:: console
 
+    $ # Running in the current environment
     $ python runtests.py wagtail.core
 
+    $ # Running in a specified Tox environment
+    $ tox -e py36-dj20-sqlite-noelasticsearch wagtail.core
+
+    $ # See a list of available Tox environments
+    $ tox -l
+
 You can also run tests for individual TestCases by passing in the path as
 an argument to ``runtests.py``
 
 .. code-block:: console
 
+    $ # Running in the current environment
     $ python runtests.py wagtail.core.tests.test_blocks.TestIntegerBlock
 
+    $ # Running in a specified Tox environment
+    $ tox -e py36-dj20-sqlite-noelasticsearch wagtail.core.tests.test_blocks.TestIntegerBlock
+
 **Running migrations for the test app models**
 
 You can create migrations for the test app by running the following from the Wagtail root.

+ 1 - 0
docs/releases/2.4.rst

@@ -26,6 +26,7 @@ Other features
  * Added ``max_count`` option on page models to limit the number of pages of a particular type that can be created (Dan Braghis)
  * Document and image choosers now show the document / image's collection (Alejandro Garza, Janneke Janssen)
  * New ``image_url`` template tag allows to generate dynamic image URLs, so image renditions are being created outside the main request which improves performance. Requires extra configuration, see :doc:`/advanced_topics/images/image_serve_view` (Yannick Chabbert, Dan Braghis).
+ * Added ability to run individual tests through tox (Benjamin Bach)
 
 Bug fixes
 ~~~~~~~~~

+ 1 - 1
tox.ini

@@ -30,7 +30,7 @@ commands =
     elasticsearch2: coverage run runtests.py wagtail.search wagtail.documents wagtail.images --elasticsearch2
     elasticsearch5: coverage run runtests.py wagtail.search wagtail.documents wagtail.images --elasticsearch5
     elasticsearch6: coverage run runtests.py wagtail.search wagtail.documents wagtail.images --elasticsearch6
-    noelasticsearch: coverage run runtests.py
+    noelasticsearch: coverage run runtests.py {posargs}
 
 basepython =
     py34: python3.4