summaryrefslogtreecommitdiff
path: root/tests/delete_regress/tests.py
AgeCommit message (Collapse)Author
2024-02-08Fixed #35073 -- Avoided unnecessary calling of callables used by ↵bcail
SET/SET_DEFAULT in Collector.collect().
2023-12-31Used addCleanup() in tests where appropriate.Mariusz Felisiak
2023-07-07Refs #32433 -- Reallowed calling QuerySet.delete() after distinct().Simon Charette
While values(*field_excluding_pk).distinct() and distinct(*field_excluding_pk) can reduce the number of resulting rows in a way that makes subsequent delete() calls ambiguous standalone .distinct() calls cannot. Since delete() already disallows chain usages with values() the only case that needs to be handled, as originally reported, is when DISTINCT ON is used via distinct(*fields). Refs #32682 which had to resort to subqueries to prevent duplicates in the admin and caused significant performance regressions on MySQL (refs #34639). This partly reverts 6307c3f1a123f5975c73b231e8ac4f115fd72c0d.
2023-05-01Fixed #33759 -- Avoided unnecessary subquery in QuerySet.delete() with ↵4the4ryushin
self-referential subqueries if supported.
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
2022-08-27Fixed #33928 -- Avoided unnecessary queries when cascade updating.Simon Charette
Models that use SET, SET_NULL, and SET_DEFAULT as on_delete handler don't have to fetch objects for the sole purpose of passing them back to a follow up UPDATE query filtered by the retrieved objects primary key. This was achieved by flagging SET handlers as _lazy_ and having the collector logic defer object collections until the last minute. This should ensure that the rare cases where custom on_delete handlers are defined remain uncalled when when dealing with an empty collection of instances. This reduces the number queries required to apply SET handlers from 2 to 1 where the remaining UPDATE use the same predicate as the non removed SELECT query. In a lot of ways this is similar to the fast-delete optimization that was added in #18676 but for updates this time. The conditions only happen to be simpler in this case because SET handlers are always terminal. They never cascade to more deletes that can be combined. Thanks Renan GEHAN for the report.
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
2021-04-27Refs #32682 -- Fixed QuerySet.delete() crash on querysets with ↵Mariusz Felisiak
self-referential subqueries on MySQL.
2021-02-11Fixed #32433 -- Added error message on QuerySet.delete() following distinct().Egidijus Macijauskas
2021-02-11Refs #19102 -- Removed flaky test ↵Egidijus Macijauskas
Ticket19102Tests.test_ticket_19102_distinct_on. The subquery pushdown only happens because another table is involved in filter. It's not the distinct usage that causes the pushdown. The distinct('description').order_by('pk') expression is not valid because SELECT DISTINCT ON must match initial ORDER BY expressions which is not the case here.
2018-11-27Switched setUp() to setUpTestData() where possible in Django's tests.Simon Charette
2018-03-16Fixed hanging indentation in various code.Mariusz Felisiak
2018-01-13Fixed #29016 -- Fixed incorrect foreign key nullification on related ↵Étienne Loks
instance deletion.
2017-07-29Used assertRaisesMessage() to test Django's error messages.Mads Jensen
2017-01-18Refs #23919 -- Removed encoding preambles and future importsClaude Paroz
2015-09-09Changed database connection duplication technique.Aymeric Augustin
This new technique is more straightforward and compatible with test parallelization, where the effective database connection settings no longer match settings.DATABASES.
2015-08-31Fixed #25331 -- Removed trailing blank lines in docstrings.Maxime Lorant
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2014-03-22Fixed #22308 -- Regression from 0f956085.Aymeric Augustin
Rewrote the test for #9479 according to the original ticket.
2014-03-21Removed legacy transaction management per the deprecation timeline.Aymeric Augustin
2013-11-02PEP8 cleanupJason Myers
Signed-off-by: Jason Myers <jason@jasonamyers.com>
2013-10-26Fix all violators of E231Alex Gaynor
2013-10-23Fixed #21298 -- Fixed E301 pep8 warningsAlasdair Nicol
2013-10-18Fixed #21268 -- Fixed E303 pep8 warningsAlasdair Nicol
2013-09-08Removed some more unused local varsAlex Gaynor
2013-07-29Removed most of absolute_import importsClaude Paroz
Should be unneeded with Python 2.7 and up. Added some unicode_literals along the way.
2013-06-10Defined available_apps in relevant tests.Aymeric Augustin
Fixed #20483.
2013-03-11Made transaction.managed a no-op and deprecated it.Aymeric Augustin
enter_transaction_management() was nearly always followed by managed(). In three places it wasn't, but they will all be refactored eventually. The "forced" keyword argument avoids introducing behavior changes until then. This is mostly backwards-compatible, except, of course, for managed itself. There's a minor difference in _enter_transaction_management: the top self.transaction_state now contains the new 'managed' state rather than the previous one. Django doesn't access self.transaction_state in _enter_transaction_management.
2013-02-27Fixed #19861 -- Transaction ._dirty flag improvementAnssi Kääriäinen
There were a couple of errors in ._dirty flag handling: * It started as None, but was never reset to None. * The _dirty flag was sometimes used to indicate if the connection was inside transaction management, but this was not done consistently. This also meant the flag had three separate values. * The None value had a special meaning, causing for example inability to commit() on new connection unless enter/leave tx management was done. * The _dirty was tracking "connection in transaction" state, but only in managed transactions. * Some tests never reset the transaction state of the used connection. * And some additional less important changes. This commit has some potential for regressions, but as the above list shows, the current situation isn't perfect either.
2013-02-26Merged regressiontests and modeltests into the test root.Florian Apolloner