summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorFrançois Freitag <mail@franek.fr>2019-03-07 21:58:30 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-04-30 16:20:51 +0200
commit568eed9e79470b9ddf3e1b3bbad9123ada45eae8 (patch)
tree6606bd5bad518d0aed7f892148f4aa8fbf4188cf /docs
parent719b7466203181066d9537d2e3bec687dffc9f41 (diff)
Fixed #30245 -- Added -k option to DiscoverRunner.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/django-admin.txt14
-rw-r--r--docs/releases/3.0.txt6
-rw-r--r--docs/topics/testing/advanced.txt5
3 files changed, 23 insertions, 2 deletions
diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt
index a269f6f8c6..4c7396f929 100644
--- a/docs/ref/django-admin.txt
+++ b/docs/ref/django-admin.txt
@@ -1360,7 +1360,7 @@ The ``test`` command receives options on behalf of the specified
:option:`--testrunner`. These are the options of the default test runner:
:class:`~django.test.runner.DiscoverRunner`.
-.. django-admin-option:: --keepdb, -k
+.. django-admin-option:: --keepdb
Preserves the test database between test runs. This has the advantage of
skipping both the create and destroy actions which can greatly decrease the
@@ -1438,6 +1438,18 @@ May be specified multiple times and combined with :option:`test --exclude-tag`.
Excludes tests :ref:`marked with the specified tags <topics-tagging-tests>`.
May be specified multiple times and combined with :option:`test --tag`.
+.. django-admin-option:: -k TEST_NAME_PATTERNS
+
+.. versionadded:: 3.0
+
+Runs test methods and classes matching test name patterns, in the same way as
+:option:`unittest's -k option<unittest.-k>`. Can be specified multiple times.
+
+.. admonition:: Python 3.7 and later
+
+ This feature is only available for Python 3.7 and later.
+
+
``testserver``
--------------
diff --git a/docs/releases/3.0.txt b/docs/releases/3.0.txt
index 66dfde0b5d..b78d4bd6ab 100644
--- a/docs/releases/3.0.txt
+++ b/docs/releases/3.0.txt
@@ -238,6 +238,9 @@ Tests
attribute :attr:`~django.test.Response.exc_info`, a tuple providing
information of the exception that occurred.
+* Tests and test cases to run can be selected by test name pattern using the
+ new :option:`test -k` option.
+
URLs
~~~~
@@ -360,6 +363,9 @@ Miscellaneous
This converts ``'`` to ``&#x27;`` instead of the previous equivalent decimal
code ``&#39;``.
+* The ``django-admin test -k`` option now works as the :option:`unittest
+ -k<unittest.-k>` option rather than as a shortcut for ``--keepdb``.
+
.. _deprecated-features-3.0:
Features deprecated in 3.0
diff --git a/docs/topics/testing/advanced.txt b/docs/topics/testing/advanced.txt
index 0a228fc4ef..2e4171d376 100644
--- a/docs/topics/testing/advanced.txt
+++ b/docs/topics/testing/advanced.txt
@@ -424,7 +424,7 @@ behavior. This class defines the ``run_tests()`` entry point, plus a
selection of other methods that are used to by ``run_tests()`` to set up,
execute and tear down the test suite.
-.. class:: DiscoverRunner(pattern='test*.py', top_level=None, verbosity=1, interactive=True, failfast=False, keepdb=False, reverse=False, debug_mode=False, debug_sql=False, **kwargs)
+.. class:: DiscoverRunner(pattern='test*.py', top_level=None, verbosity=1, interactive=True, failfast=False, keepdb=False, reverse=False, debug_mode=False, debug_sql=False, test_name_patterns=None, **kwargs)
``DiscoverRunner`` will search for tests in any file matching ``pattern``.
@@ -463,6 +463,9 @@ execute and tear down the test suite.
as the traceback. If ``verbosity`` is ``2``, then queries in all tests are
output.
+ ``test_name_patterns`` can be used to specify a set of patterns for
+ filtering test methods and classes by their names.
+
Django may, from time to time, extend the capabilities of the test runner
by adding new arguments. The ``**kwargs`` declaration allows for this
expansion. If you subclass ``DiscoverRunner`` or write your own test