summaryrefslogtreecommitdiff
path: root/django/test/runner.py
AgeCommit message (Collapse)Author
2023-02-01[4.2.x] Refs #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 Backport of 097e3a70c1481ee7b042b2edd91b2be86fb7b5b6 from main
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.
2021-04-02Refs #32532 -- Replaced is_discoverable() with try_importing().Chris Jerdonek
2021-03-30Fixed #29127 -- Prevented DiscoverRunner from hiding tagged test with syntax ↵Chris Jerdonek
errors. This mades _FailedTest objects always match tags in DiscoverRunner.
2021-03-29Simplified and optimized test_match_tags().Chris Jerdonek
This simplifies and optimizes runner.py's test_match_tags() because it (1) uses isdisjoint() instead of intersection(), which involves constructing a new set, (2) eliminates a set operation when tags is falsey, (3) eliminates the need for a matched_tags variable, and (4) uses fewer not's, which should make it easier to parse and understand.
2021-03-26Fixed #32591 -- Made DiscoverRunner order _FailedTest objects first.Chris Jerdonek
Failures detected when loading tests are ordered before all of the above for quicker feedback. This includes things like test modules that couldn't be found or that couldn't be loaded due to syntax errors.
2021-03-24Fixed typo in DiscoverRunner --reverse help text.Chris Jerdonek
2021-03-24Refs #32532 -- Added DiscoverRunner.load_tests_for_label().Chris Jerdonek
2021-03-18Fixed #31370 -- Added support for parallel tests with --buffer.Adam Johnson
2021-03-18Refs #31370 -- Made RemoteTestResult subclass unittest.TestResult.Adam Johnson
2021-03-17Fixed #32560 -- Fixed test runner with --pdb and --buffer on fail/error.Adam Johnson
2021-03-15Fixed #32540 -- Optimized DiscoverRunner.build_suite() by calling ↵Chris Jerdonek
find_top_level() only if is_discoverable() is true.
2021-03-15Refs #32540 -- Added django.test.runner.find_top_level().Chris Jerdonek
2021-03-12Reduced nesting inside DiscoverRunner.build_suite().Chris Jerdonek
2021-03-11Fixed #32529 -- Delayed creating a test suite in build_suite().Chris Jerdonek
2021-03-09Fixed #32516 -- Fixed reorder_suite() with duplicates and reverse=True.Chris Jerdonek
2021-03-08Refs #32489 -- Simplified filter_tests_by_tags().Chris Jerdonek
2021-03-08Refs #32489 -- Simplified partition_suite_by_case().Chris Jerdonek
2021-03-08Refs #32489 -- Removed unneeded partition_suite_by_type().Chris Jerdonek
2021-03-05Fixed #32489 -- Added iter_test_cases() to iterate over a TestSuite.Chris Jerdonek
This also makes partition_suite_by_type(), partition_suite_by_case(), filter_tests_by_tags(), and DiscoverRunner._get_databases() to use iter_test_cases().
2021-03-05Simplified for loop in reorder_suite().Chris Jerdonek
2021-02-24Fixed #32446 -- Deprecated SERIALIZE test database setting.Simon Charette
Whether or not the state of a test database should be serialized can be inferred from the set of databases allowed to be access from discovered TestCase/TransactionTestCase enabling the serialized_rollback feature which makes this setting unnecessary. This should make a significant test suite bootstraping time difference on large projects that didn't explicitly disable test database serialization.
2021-02-10Fixed #32355 -- Dropped support for Python 3.6 and 3.7Mariusz Felisiak