summaryrefslogtreecommitdiff
path: root/tests/test_runner/tests.py
AgeCommit message (Collapse)Author
2025-10-29Fixed #36678 -- Limited retries in ParallelTestRunner.Jacob Walls
Thanks Natalia Bidart for the review.
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-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
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-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-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-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-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 -- Reformatted code with Black.django-bot
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-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-06-29Refs #32655 -- Improved error if iter_test_cases() is passed a string.Chris Jerdonek
2021-03-11Fixed #32529 -- Delayed creating a test suite in build_suite().Chris Jerdonek
2021-03-11Refs #32489 -- Doc'd and tested iter_test_cases() support for an iterable of ↵Chris Jerdonek
tests.
2021-03-09Fixed #32516 -- Fixed reorder_suite() with duplicates and reverse=True.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-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-16Fixed #29052 -- Made test database creation preserve alias order and prefer ↵Harm Geerts
the "default" database. This fixes flushing test databases when two aliases point to the same database. Use a list() to store the test database aliases so the order remains stable by following the order of the connections. Also, always use the "default" database alias as the first alias to accommodate `migrate`. Previously `migrate` could be executed on a secondary alias which caused truncating the "default" database.
2020-12-10Fixed isolation of test_runner.EmptyDefaultDatabaseTest.Mariusz Felisiak
This fixes test_runner.test_debug_sql.TestDebugSQL. test_setupclass_exception when run in reverse.
2020-08-13Refs #31811 -- Added optional timing outputs to the test runner.Ahmad A. Hussein
2019-08-07Corrected several typos in string literals and test names.Min ho Kim
2019-02-05Simplified temporary directory handling in AdminScriptTestCase.Jon Dufresne
Use tempfile.TemporaryDirectory() in AdminScriptTestCase.setUp() to create and destroy a temporary directory for each test. It removes the need for individual tests to delete files. For test classes that don't use the temporary directory, inherit from SimpleTestCase.
2019-01-10Refs #28478 -- Deprecated TestCase's allow_database_queries and multi_db in ↵Simon Charette
favor of databases.
2018-12-24Refs #26840 -- Corrected SQLite connection mocking in a setup_databases() test.Simon Charette
The test was expecting connections used by DiscoverRunner.setup_databases() to be the ones defined in django.test.runner but this doesn't hold true since this method was made a proxy of django.test.utils.setup_databases. This broke the TransactionTestCase.serialized_rollback feature in the test suite because calls to create_db_test() cleared the test data persisted on connections objects. Added an assertions to prevent this from happening again.
2018-12-22Renamed Sqlite and Sqlite3 references to SQLite.Nick Pope
2018-12-15Fixed #30023 -- Prevented SQLite schema alterations while foreign key checks ↵Simon Charette
are enabled. Prior to this change foreign key constraint references could be left pointing at tables dropped during operations simulating unsupported table alterations because of an unexpected failure to disable foreign key constraint checks. SQLite3 does not allow disabling such checks while in a transaction so they must be disabled beforehand. Thanks ezaquarii for the report and Carlton and Tim for the review.
2018-10-30Fixed #29866 -- Made DiscoverRunner do tests tear down if running checks or ↵Jayden Kneller
tests raises an exception.
2018-08-23Fixed #29704 -- Fixed manage.py test --testrunner if it isn't followed by an ↵Matthijs Kooijman
equals sign.
2018-08-23Added manage.py test --testrunner tests.Matthijs Kooijman
2018-07-11Fixed #29559 -- Fixed TransactionTestCase.reset_sequences for auto-created ↵Oliver Sauder
m2m through models.
2018-07-11Refs #9804 -- Fixed test for sequence reset of M2M with inherited through model.Tim Graham
2017-02-10Added multi_db=True to test cases that access the 'other' db connection.Tim Graham
Fixed a failure in the context processors tests when running in reverse on MySQL due to an extra query after refs #27683.
2017-02-03Fixed spelling of "nonexistent".Tim Graham
2017-01-20Refs #23919 -- Removed django.test.mock Python 2 compatibility shim.Tim Graham
2017-01-19Refs #23919 -- Stopped inheriting from object to define new style classes.Simon Charette
2017-01-18Refs #23919 -- Removed encoding preambles and future importsClaude Paroz
2016-12-28Refs #25415 -- Fixed/silenced check errors in Django's test suite.Adam Chainz