summaryrefslogtreecommitdiff
path: root/tests/test_runner
AgeCommit message (Collapse)Author
2025-02-16[5.2.x] Fixed #35967 -- Deferred test suite fixtures serialization after all ↵Simon Charette
dbs setup. 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. Backport of dc69a63f844b2ef3bc3371edde91644cf0bef0ee from main
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
2021-06-29Refs #32655 -- Improved error if iter_test_cases() is passed a string.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-10Fixed typo in tests/test_runner/test_discover_runner.py.Mariusz Felisiak
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-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-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-25Fixed RemoteTestResultTest tests without tblib.Mariusz Felisiak
Follow up to e3bca22e7e572b0274a0814c7869c899d7b544e0.
2021-03-18Fixed #31370 -- Added support for parallel tests with --buffer.Adam Johnson
2021-03-18Refs #31370 -- Made RemoteTestResult subclass unittest.TestResult.Adam Johnson