summaryrefslogtreecommitdiff
path: root/django/test/runner.py
AgeCommit message (Collapse)Author
2026-01-18Applied Black's 2026 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/26.1.0
2025-12-03Closed pool when parallel test runner encounters unpicklable exceptions.Jacob Walls
2025-10-29Fixed #36678 -- Limited retries in ParallelTestRunner.Jacob Walls
Thanks Natalia Bidart for the review.
2025-10-28Fixed #36596 -- Made parallel test runner respect django_test_skips and ↵Mariusz Felisiak
django_test_expected_failures.
2025-10-21Fixed #36677 -- Fixed scheduling of system checks in ParallelTestSuite workers.Jacob Walls
Running system checks in workers must happen after database aliases are set up. Regression in 606fc352799e372928fa2c978ab99f0fb6d6017c.
2025-09-26Fixed #36491 -- Fixed crash in ParallelTestRunner with --buffer.Shubham Singh
Thanks Javier Buzzi and Adam Johnson for reviews. Co-authored-by: Simon Charette <charette.s@gmail.com>
2025-09-16Fixed #36083 -- Ran system checks in ParallelTestSuite workers.Adam Zapletal
Workers created by ParallelTestSuite were not running system checks in the spawn multiprocessing mode. In general this is fine, but system checks can have side effects expected by tests. This patch runs system checks inside of _init_worker, which is only called by ParallelTestSuite.
2025-07-29Fixed #36531 -- Added forkserver support to parallel test runner.Mariusz Felisiak
2025-06-16Fixed #36380 -- Deferred SQL formatting when running tests with --debug-sql.Natalia
Thanks to Jacob Walls for the report and previous iterations of this fix, to Simon Charette for the logging formatter idea, and to Tim Graham for testing and ensuring that 3rd party backends remain compatible. This partially reverts d8f093908c504ae0dbc39d3f5231f7d7920dde37. Refs #36112, #35448. Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2025-01-20Fixed #36005 -- Dropped support for Python 3.10 and 3.11.Mariusz Felisiak
2025-01-18Fixed #35448 -- Fixed formatting of test --debug-sql output.Tim Graham
Also adds DatabaseOperations.format_debug_sql() hook for backends (e.g. NoSQL) to customize formatting.
2025-01-04Fixed #36057 -- Enabled test runner to debug chained exceptions with `--pdb` ↵Adam Johnson
on Python 3.13+.
2024-11-06Fixed #35849 -- Made ParallelTestSuite report correct error location.David Winiecki
2024-11-06Refs #35849 -- Added a handle_event hook to ParallelTestSuite.David Winiecki
2024-03-09Moved --failfast to DiscoverRunner.Adam Johnson
2023-10-23Fixed #34903, Refs #34825 -- Made workers initialization respect empty set ↵David Sanders
of used connections. Thanks to David Smith for the investigation & patch. Regression in 2128a73713735fb794ca6565fd5d7792293f5cfa. Follow up to a5905b164dbf52e59fa646af9c3d523c0804d86a. Co-authored-by: David Sanders <shang.xiao.sanders@gmail.com>
2023-10-02Fixed #32602 -- Clarified wording of TestCase class.faishalmanzar
2023-09-25Fixed #34825 -- Avoided setting unused connections when initializing ↵David Sanders
parallel workers.
2023-08-31Fixed #34210 -- Added unittest's durations option to the test runner.David Smith
2023-02-01Refs #33476 -- Applied Black's 2023 stable style.David Smith
Black 23.1.0 is released which, as the first release of the year, introduces the 2023 stable style. This incorporates most of last year's preview style. https://github.com/psf/black/releases/tag/23.1.0
2023-01-18Fixed #34233 -- Dropped support for Python 3.8 and 3.9.Mariusz Felisiak
2023-01-17Refs #32655 -- Removed extra_tests argument for ↵Mariusz Felisiak
DiscoverRunner.build_suite()/run_tests(). Per deprecation timeline.
2022-10-24Fixed #34111 -- Made test runner with --debug-sql format SQL queries.Giebisch
2022-09-28Refs #34010 -- Made --debug-mode work for parallel tests using spawn.Adam Johnson
Bug in 3b3f38b3b09b0f2373e51406ecb8c9c45d36aebc. Thanks Kevin Renskers for the report.
2022-09-28Fixed #34010 -- Made parallel tests using spawn set up Django.Adam Johnson
Bug in 3b3f38b3b09b0f2373e51406ecb8c9c45d36aebc. Thanks Kevin Renskers for the report.
2022-08-04Fixed #33891 -- Fixed test command crash when running in parallel using spawn.Mariusz Felisiak
Thanks Kevin Renskers for the report. Regression in 41c4cb253c137edf5a96b7408ea55d57d6e0602a.
2022-07-19Fixed #33855 -- Removed unnecessary system check calls from test worker ↵Mariusz Felisiak
initialization. Regression in 3b3f38b3b09b0f2373e51406ecb8c9c45d36aebc.
2022-05-19Fixed #33719 -- Fixed test command crash when running in parallel.Mariusz Felisiak
Thanks Pēteris Caune for the report. Regression in 3b3f38b3b09b0f2373e51406ecb8c9c45d36aebc.
2022-03-17Refs #31169 -- Prevented infinite loop in parallel tests with custom test ↵David Smith
runner when using spawn. Regression in 3b3f38b3b09b0f2373e51406ecb8c9c45d36aebc. Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-03-15Fixed #31169 -- Adapted the parallel test runner to use spawn.David Smith
Co-authored-by: Valz <ahmadahussein0@gmail.com> Co-authored-by: Nick Pope <nick@nickpope.me.uk>
2022-02-23Refs #31169 -- Added DatabaseCreation.setup_worker_connection() hook.Valz
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-11-08Fixed #33264 -- Made test runner return non-zero error code for unexpected ↵Baptiste Mispelon
successes.
2021-10-12Fixed #28401 -- Allowed hashlib.md5() calls to work with FIPS kernels.Ade Lee
md5 is not an approved algorithm in FIPS mode, and trying to instantiate a hashlib.md5() will fail when the system is running in FIPS mode. md5 is allowed when in a non-security context. There is a plan to add a keyword parameter (usedforsecurity) to hashlib.md5() to annotate whether or not the instance is being used in a security context. In the case where it is not, the instantiation of md5 will be allowed. See https://bugs.python.org/issue9216 for more details. Some downstream python versions already support this parameter. To support these versions, a new encapsulation of md5() has been added. This encapsulation will pass through the usedforsecurity parameter in the case where the parameter is supported, and strip it if it is not. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-10-11Fixed #33149 -- Made test runner --pdb option work with subTest().Abhyudai
Thanks Lucidot for the report and Mariusz Felisiak for the initial patch.
2021-08-24Fixed #32552 -- Added logger argument to DiscoverRunner.Chris Jerdonek
2021-08-19Refs #31621 -- Fixed handling --parallel option in test management command ↵Mariusz Felisiak
and runtests.py. Regression in ae89daf46f83a7b39d599d289624c3377bfa4ab1. Thanks Tim Graham for the report.
2021-08-05Fixed #32988 -- Prevented creation of more test databases than TestCases.Mariusz Felisiak
DiscoverRunner.parallel is used in setup_databases() and teardown_databases() to control the number of test databases. Regression in cb6c19749d342c3dc0f97d89ff6887b220cf45b8.
2021-08-03Fixed #31621 -- Added support for '--parallel auto' to test management command.Adam Johnson
2021-07-16Fixed #32655 -- Deprecated extra_tests argument for ↵Jacob Walls
DiscoverRunner.build_suite()/run_tests().
2021-07-12Fixed #32914 -- Prevented test --shuffle from skipping test methods.Chris Jerdonek
"test --shuffle" skipped test methods when test classes were mixed. This changes runner.py's reorder_tests() to group by TestCase class. Regression in 90ba716bf060ee7fef79dc230b0b20644839069f.
2021-07-09Refs #24522 -- Fixed code comment about seeds in Shuffler.__init__().Chris Jerdonek
2021-07-08Fixed #24522 -- Added a --shuffle option to DiscoverRunner.Chris Jerdonek
2021-06-10Fixed #32609 -- Updated runtests.py to support directory path test labels.Chris Jerdonek
For example, with this change, the following now works from the tests directory: $ ./runtests.py view_tests/tests/
2021-06-10Refs #27734 -- Prevented creation of more parallel workers than TestCases.Ceesjan Luiten
The parallel test runner uses multiple workers to distribute the workload. These workers are assigned a worker ID using a globally incremented variable, which determines what test database to connect to. When the worker ID surpasses the test database IDs Django will crash. This reduce likelihood of crashing parallel tests because ParallelTestSuite will no longer create more workers than TestCases. It won't eliminate the problem completely though because there are other circumstances in which new workers can be created which can then be assigned an "illegal" worker ID.
2021-06-03Fixed #32808 -- Prevented DiscoverRunner.build_suite() from mutating test ↵Mariusz Felisiak
loader patterns. Thanks Chris Jerdonek for the report and reviews.
2021-06-02Refs #32641 -- Made DiscoverRunner's "Found X tests" message work for ↵Chris Jerdonek
finding one test. This also removes passing level to log() as logging.INFO is the default.
2021-06-01Refs #32552 -- Added DiscoverRunner.log() to allow customization.Daniyal
Thanks Carlton Gibson, Chris Jerdonek, and David Smith for reviews.
2021-04-15Fixed #32641 -- Made DiscoverRunner print the number of found tests.girishsontakke
Thanks Chris Jerdonek for reviews.
2021-04-02Fixed #32532 -- Made DiscoverRunner raise RuntimeError when a test label is ↵Chris Jerdonek
a file path.