summaryrefslogtreecommitdiff
path: root/tests/test_runner
AgeCommit message (Collapse)Author
2026-02-26Refs #36936 - Adjusted tests to set PYTHON_COLORS environment variable.Pete Rosenblum
When "FORCE_COLOR" was set in the environment (such as in django-docker-box) several test cases that rely on string comparisons against exception messages or command line results would fail due to ANSI escape sequences being present in the output. This change resolved the issue by setting the "PYTHON_COLORS" environment variable to "0" for those specific tests, which takes precendence over the presence of "FORCE_COLOR".
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-21Made RemoteTestResultTest.test_pickle_errors_detection() compatible with ↵Mariusz Felisiak
tblib 3.2+. tblib 3.2+ makes exception subclasses with __init__() and the default __reduce__() picklable. This broke the test for RemoteTestResult._confirm_picklable(), which expects a specific exception to fail unpickling. https://github.com/ionelmc/python-tblib/blob/master/CHANGELOG.rst#320-2025-10-21 This fix defines ExceptionThatFailsUnpickling.__reduce__() in a way that pickle.dumps(obj) succeeds, but pickle.loads(pickle.dumps(obj)) raises TypeError. Refs #27301. This preserves the intent of the regression test from 52188a5ca6bafea0a66f17baacb315d61c7b99cd without skipping it.
2025-10-02Refs #36491 -- Skipped ↵Mariusz Felisiak
ParallelTestSuiteTest.test_buffer_mode_reports_setupclass_failure() without tblib.
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-07-23Refs #36500 -- Rewrapped long docstrings and block comments via a script.django-bot
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
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-02-16Refs #35967 -- Deprecated BaseDatabaseCreation.create_test_db(serialize).Simon Charette
Given there are no longer any internal usages of serialize=True and it poses a risk to non-test databases integrity it seems appropriate to deprecate it.
2025-02-16Fixed #35967 -- Deferred test suite fixtures serialization after all dbs setup.Simon Charette
While the top-level objects fed to serialization are bound to the test database being created nothing prevents code invoked during serialization from performing queries against other connections entries that haven't been swapped yet. The reported example of that is a database router directing all reads to a test mirror for a set of models involving auto-created many-to-many fields. It might be tempting to address the many-to-many field case but this a symptom of a larger problem where the test framework yields the flow execution to user code that could interact with non-test databases in unexpected ways. Deferring test database fixture serialization until the point where all connections entries have been swapped for their test equivalent ensures that no code triggered during serialization can interact with non-test databases. Thanks Jake Howard for the report and Jacob Walls for the initial investigation.
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.
2024-11-11Removed redundant RemoteTestResultTest._test_error_exc_info() test hook.Mariusz Felisiak
2024-11-11Refs #35849 -- Skipped ↵Mariusz Felisiak
ParallelTestSuiteTest.test_handle_add_error_before_first_test() without tblib. Follow up to 661dfdd59809f4abd5077f7a2529735d07b98ba4.
2024-11-06Fixed #35849 -- Made ParallelTestSuite report correct error location.David Winiecki
2024-10-24Refs #35844 -- Fixed tests for test --parallel option on Python 3.14+.Mariusz Felisiak
"forkserver" is the new default on POSIX systems, and Django doesn't support parallel tests with "forkserver": https://github.com/python/cpython/commit/b65f2cdfa77d8d12c213aec663ddaaa30d75a4b2
2024-02-22Refs #32114 -- Fixed RemoteTestResultTest.test_unpicklable_subtest test ↵Mariusz Felisiak
without tblib. Follow up to c09e8f5fd8f977bf16e9ec5d11b370151fc81ea8.
2024-02-21Fixed #32114 -- Fixed parallel test crash on non-picklable objects in subtests.David Wobrock
2024-01-26Applied Black's 2024 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/24.1.0
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-08-23Fixed ResourceWarning from unclosed SQLite connection on Python 3.13+.Mariusz Felisiak
- backends.sqlite.tests.ThreadSharing.test_database_sharing_in_threads - backends.tests.ThreadTests.test_default_connection_thread_local: on SQLite, close() doesn't explicitly close in-memory connections. - servers.tests.LiveServerInMemoryDatabaseLockTest - test_runner.tests.SQLiteInMemoryTestDbs.test_transaction_support Check out https://github.com/python/cpython/pull/108015.
2023-08-22Removed unnecessary trailing commas in tests.konsti
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-17Refs #32655 -- Removed extra_tests argument for ↵Mariusz Felisiak
DiscoverRunner.build_suite()/run_tests(). Per deprecation timeline.
2023-01-17Refs #32446 -- Removed SERIALIZE test database setting per deprecation timeline.Mariusz Felisiak
2022-10-31Avoided assignment followed by immediate return.Nick Pope
Identified using the following command: $ pcre2grep --line-number --multiline --recursive \ "(?s)(\n +)(\w+) = [^\n]+\1return \2;?$" \ django docs extras js_tests scripts tests
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-05-19Fixed #33719 -- Fixed test command crash when running in parallel.Mariusz Felisiak
Thanks Pēteris Caune for the report. Regression in 3b3f38b3b09b0f2373e51406ecb8c9c45d36aebc.
2022-04-07Refs #33173 -- Fixed test_runner/test_utils tests on Python 3.11+.Mariusz Felisiak
Python 3.11 uses fully qualified test name in unittest output. See https://github.com/python/cpython/commit/755be9b1505af591b9f2ee424a6525b6c2b65ce9
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-07Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2022-02-03Refs #33476 -- Refactored problematic code before reformatting by Black.Mariusz Felisiak
In these cases Black produces unexpected results, e.g. def make_random_password( self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789', ): or cursor.execute(""" SELECT ... """, [table name], )
2021-11-08Fixed #33264 -- Made test runner return non-zero error code for unexpected ↵Baptiste Mispelon
successes.
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-19Refs #31621 -- Added more tests for test --parallel option.Mariusz Felisiak
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-08-03Refs #31621 -- Added more tests for test --parallel option.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-08Fixed #24522 -- Added a --shuffle option to DiscoverRunner.Chris Jerdonek
2021-07-07Used more specific unittest assertions in tests.Mads Jensen