summaryrefslogtreecommitdiff
path: root/django/test/testcases.py
AgeCommit message (Collapse)Author
2026-04-16Added DatabaseFeatures.disallowed_simple_test_case_connection_methods.Tim Graham
2026-03-30Refs #36770 -- Guarded against an endless wait in LiveServerThread.terminate().Jacob Walls
terminate() shouldn't assume the main server was started. (A deadlock from mishandling of in-memory SQLite databases may have occurred.)
2026-03-16Fixed #36859 -- Made assertContains and assertNotContains idempotent for ↵Baptiste Mispelon
streaming responses.
2026-01-31Refs #34118 -- Removed asgiref coroutine detection shims.Jacob Walls
As Python 3.12 is now the floor, we can drop the shims and use the `inspect` module.
2025-12-19Fixed #36487 -- Fixed logger error message with partial callbacks.Krishnaprasad MG
2025-09-15Fixed #36589 -- Made assertTemplateUsed/NotUsed track full path for ↵Caitie Baca
PartialTemplate. Previously, assertTemplateUsed only matched partial names, ignoring the template origin. This caused assertions on partials specified by origin ("template.html#partial") to fail. Refs #36410.
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-07-18Fixed #35728 -- Computed error messages in assertions only on test failures.Clifford Gama
Performance regression in 1dae65dc63ae84be5002c37b4ddae0b9220e8808. Thanks to Adam Johnson for the report.
2025-06-21Removed @skipIfDBFeature silencing of nonexistent features.Tim Graham
Follow up to f5df7ed7e62585c7d0289a88a327dab8d608efcf.
2025-06-20Removed @skipUnlessDBFeature silencing of nonexistent features.Tim Graham
This was added in 46c7707e50400e237cbd774a31ad801669ca3905 but is obsolete now that gis_tests are discovered separately. It's error-prone to ignore mistyped names.
2025-01-20Fixed #36005 -- Dropped support for Python 3.10 and 3.11.Mariusz Felisiak
2024-09-17Fixed #35660 -- Made serialized_rollback and fixture data available in ↵Jacob Walls
TransactionTestCase.setUpClass().
2024-09-17Refs #35660 -- Updated TransactionTestCase methods into class or static methods.Jacob Walls
2024-08-08Fixed #35622 -- Made unittest ignore Django assertions in traceback frames.Adam Johnson
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2024-07-22Fixed typo in django/test/testcases.py docstring.Jacob Walls
2024-05-29Fixed 35467 -- Replaced urlparse with urlsplit where appropriate.Jake Howard
This work should not generate any change of functionality, and `urlsplit` is approximately 6x faster. Most use cases of `urlparse` didn't touch the path, so they can be converted to `urlsplit` without any issue. Most of those which do use `.path`, simply parse the URL, mutate the querystring, then put them back together, which is also fine (so long as urlunsplit is used).
2024-02-26Refs #32114 -- Fixed test crash on non-picklable objects in subtests when ↵David Wobrock
PickleError is raised. Related to the https://github.com/python/cpython/issues/73373. Follow up to c09e8f5fd8f977bf16e9ec5d11b370151fc81ea8.
2024-02-21Fixed #32114 -- Fixed parallel test crash on non-picklable objects in subtests.David Wobrock
2024-02-19Fixed #35226 -- Reallowed executing queries for dynamically created connections.Mariusz Felisiak
Regression in 8fb0be3500cc7519a56985b1b6f415d75ac6fedb. Thanks Florian Apolloner for the report.
2024-02-14Fixed #28263 -- Fixed TestCase setup for databases that don't support ↵Tim Graham
savepoints.
2024-01-04Used enterClassContext() where appropriate.Mariusz Felisiak
2024-01-03Fixed #33277 -- Disallowed database connections in threads in SimpleTestCase.David Wobrock
2023-12-22Fixed #34658 -- Added SimpleTestCase.assertNotInHTML().Nicolas Lupien
2023-12-12Refs #34305 -- Added SimpleTestCase.enterClassContext() on Python < 3.11.Nick Pope
2023-10-03Fixed #34657 -- Made assert(Not)Contains/assertInHTML display haystacks in ↵Chinmoy Chakraborty
error messages.
2023-10-03Refs #34657 -- Made msg_prefix handling in assertURLEqual()/assertInHTML ↵Mariusz Felisiak
consistent with other assertions. Co-authored-by: Chinmoy Chakraborty <chinmoy12c@gmail.com>
2023-10-02Fixed #32602 -- Clarified wording of TestCase class.faishalmanzar
2023-09-29Refs #34657 -- Made assertInHTML() use unparsed needle in error messages.Chinmoy Chakraborty
2023-09-22Fixed #34823 -- Fixed assertTemplateUsed() context manager crash on unnamed ↵Arian
templates.
2023-09-18Refs #33990 -- Removed TransactionTestCase.assertQuerysetEqual() per ↵Mariusz Felisiak
deprecation timeline.
2023-09-18Refs #33990 -- Removed SimpleTestCase.assertFormsetError() per deprecation ↵Mariusz Felisiak
timeline.
2023-07-27Simplified call_command() calls.Nick Pope
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-18Refs #34233 -- Used str.removeprefix()/removesuffix().Mariusz Felisiak
2023-01-18Fixed #34233 -- Dropped support for Python 3.8 and 3.9.Mariusz Felisiak
2023-01-17Refs #33348 -- Removed support for passing response object and form/formset ↵Mariusz Felisiak
name to SimpleTestCase.assertFormError()/assertFormSetError(). Per deprecation timeline.
2023-01-17Refs #33348 -- Removed support for passing errors=None to ↵Mariusz Felisiak
SimpleTestCase.assertFormError()/assertFormsetErrors(). Per deprecation timeline.
2023-01-13Fixed #34240 -- Preserved headers of requests made with django.test.Client ↵Mariusz Felisiak
in assertRedirects(). Bug in 67da22f08e05018ea968fcacbac9ac37ea925d85.
2022-12-20Refs #34118 -- Adopted asgiref coroutine detection shims.Carlton Gibson
Thanks to Mariusz Felisiak for review.
2022-11-24Fixed #29062 -- Prevented possibility of database lock when using ↵baldychristophe
LiveServerTestCase with in-memory SQLite database. Thanks Chris Jerdonek for the implementation idea.
2022-10-08Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to ↵Gregor Gärtner
assertQuerySetEqual(). Co-Authored-By: Michael Howitz <mh@gocept.com>
2022-10-07Refs #33990 -- Renamed SimpleTestCase.assertFormsetError() to ↵Gregor Gärtner
assertFormSetError(). Co-Authored-By: Michael Howitz <mh@gocept.com>
2022-09-06Fixed #33616 -- Allowed registering callbacks that can fail in ↵SirAbhi13
transaction.on_commit(). Thanks David Wobrock and Mariusz Felisiak for reviews.
2022-04-06Fixed #33348 -- Changed ↵Baptiste Mispelon
SimpleTestCase.assertFormError()/assertFormsetErrors() to take form/formset. Instead of taking a response object and a context name for the form/formset, the two methods now take the object directly.
2022-03-17Prevented initialization of unused database connections.Florian Apolloner
2022-02-15Refs #33348 -- Made SimpleTestCase.assertFormError() raise ValueError when ↵Baptiste Mispelon
"field" is passed without "form_index".
2022-02-15Refs #33348 -- Fixed SimpleTestCase.assertFormError() error message raised ↵Mariusz Felisiak
for unbound forms.
2022-02-15Refs #33348 -- Improved messages raised by ↵Baptiste Mispelon
SimpleTestCase.assertFormError()/assertFormsetErrors(). This makes messages use BaseFormSet/BaseForm.__repr__() instead of context, and adds the _assert_form_error() helper.
2022-02-14Refs #33348 -- Made SimpleTestCase.assertFormsetErrors() raise an error when ↵Baptiste Mispelon
form_index is too big.
2022-02-14Refs #33348 -- Made SimpleTestCase.assertFormError()/assertFormsetErrors() ↵Baptiste Mispelon
raise an error for unbound forms/formsets.