summaryrefslogtreecommitdiff
path: root/tests/backends/tests.py
AgeCommit message (Collapse)Author
2025-12-05Fixed #36722 -- Moved AutoFieldMixin validate_autopk_value() check to ↵Clifford Gama
get_db_prep_save. The validation in validate_autopk_value is specific to saving. Having it in get_db_prep_value caused Value(0, AutoField()) to fail unexpectedly when used in a filter on MySQL. Thanks Jacob Walls 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-06-16Refs #36380 -- Replaced mocked logging assertions in tests/backends/tests.py.Natalia
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-03-01Applied Black's 2025 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/25.1.0
2025-01-25Fixed #36111 -- Fixed test --debug-sql crash on Oracle when no prior query ↵Jacob Walls
has executed.
2025-01-20Refs #35448 -- Fixed BackendTestCase.test_queries_logger() on Oracle < 23c.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-08-28Refs #12581 -- Adjusted warning stacklevel in queries ring buffer.Simon Charette
2024-08-26Added supports_sequence_reset skip in backends tests.Tim Graham
2024-01-26Applied Black's 2024 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/24.1.0
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
2022-12-15Fixed #33308 -- Added support for psycopg version 3.Daniele Varrazzo
Thanks Simon Charette, Tim Graham, and Adam Johnson for reviews. Co-authored-by: Florian Apolloner <florian@apolloner.eu> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-11-25Fixed #34103 -- Fixed logging SQL queries with duplicate parameters on Oracle.David Sanders
2022-07-05Fixed #33815 -- Fixed last_executed_query() on Oracle when parameter names ↵Mariusz Felisiak
overlap.
2022-04-18Fixed various tests on MySQL with MyISAM storage engine.Mariusz Felisiak
2022-03-22Refs #30581 -- Fixed DatabaseFeatures.bare_select_suffix on MySQL < 8 and ↵Gagaro
MariaDB < 10.4.
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-07-07Used more specific unittest assertions in tests.Mads Jensen
2021-07-02Fixed #30934 -- Included database alias in django.db.backends log messages.Nick Pope
This is useful when working with database routing as you want to know where each query is being executed. Co-authored-by: David Winterbottom <david.winterbottom@gmail.com>
2021-03-24Optimized FkConstraintsTests.test_check_constraints by specifying a database ↵Mariusz Felisiak
table.
2020-12-28Fixed #32158 -- Fixed loaddata crash on SQLite when table/column names are ↵Chinmoy Chakraborty
SQL keywords.
2020-10-28Made small readability improvements.Martin Thoma
2020-07-20Fixed #17653 -- Allowed using zero as AutoFields value on MySQL if ↵Mariusz Felisiak
NO_AUTO_VALUE_ON_ZERO SQL mode is enabled.
2020-04-20Capitalized Unicode in docs, strings, and comments.Jon Dufresne
2020-04-20Fixed #31477 -- Removed "using" argument from ↵Jon Dufresne
DatabaseOperations.execute_sql_flush().
2020-04-18Simplified LongNameTest.test_sequence_name_length_limits_flush() with ↵Jon Dufresne
execute_sql_flush().
2020-04-17Fixed #31473 -- Made sql_flush() use RESTART IDENTITY to reset sequences on ↵Jon Dufresne
PostgreSQL. The sql_flush() positional argument sequences is replaced by the boolean keyword-only argument reset_sequences. This ensures that the old function signature can't be used by mistake when upgrading Django. When the new argument is True, the sequences of the truncated tables will reset. Using a single boolean value, rather than a list, allows making a binary yes/no choice as to whether to reset all sequences rather than a working on a completely different set.
2020-02-18Fixed #31271 -- Preserved ordering when unifying query parameters on Oracle.Mariusz Felisiak
This caused misplacing parameters in logged SQL queries. Regression in 79065b55a70cd220820a260a1c54851b7be0615a. Thanks Hans Aarne Liblik for the report.
2020-02-06Fixed #31233 -- Closed database connections and cursors after use.Jon Dufresne
2020-01-20Refs #31117 -- Made various tests properly handle unexpected databases aliases.Matthijs Kooijman
- Used selected "databases" instead of django.db.connections. - Made routers in tests.migrations skip migrations on unexpected databases. - Added DiscoverRunnerGetDatabasesTests.assertSkippedDatabases() hook which properly asserts messages about skipped databases.
2019-04-29Added tests for queries log in CursorDebugWrapper.executemany().Mariusz Felisiak
2019-04-05Refs #20010 -- Unified DatabaseOperations.last_executed_query() on Oracle ↵Mariusz Felisiak
with other db backends. Thanks Simon Charette for the review.
2019-02-14Fixed #30171 -- Fixed DatabaseError in servers tests.Jon Dufresne
Made DatabaseWrapper thread sharing logic reentrant. Used a reference counting like scheme to allow nested uses. The error appeared after 8c775391b78b2a4a2b57c5e89ed4888f36aada4b.
2019-02-09Removed uneeded iter() calls with generator expression as argument.Sergey Fedoseev
2018-12-24Fixed #30056 -- Added SQLite support for StdDev and Variance functions.Nick Pope
2018-12-22Refs #14204 -- Removed obsolete referential integrity comment for SQLite.Nick Pope
2018-11-21Fixed #29949 -- Refactored db introspection identifier converters.Mariusz Felisiak
Removed DatabaseIntrospection.table_name_converter()/column_name_converter() and use instead DatabaseIntrospection.identifier_converter(). Removed DatabaseFeatures.uppercases_column_names. Thanks Tim Graham for the initial patch and review and Simon Charette for the review.
2018-05-09Fixed #29363 -- Added SimpleTestCase.assertWarnsMessage().Morgan Aubert
2017-11-28Fixed #28853 -- Updated connection.cursor() uses to use a context manager.Jon Dufresne
2017-09-07Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()."Tim Graham
This reverts commit 550cb3a365dee4edfdd1563224d5304de2a57fda because try/except performs better.
2017-06-28Fixed #27818 -- Replaced try/except/pass with contextlib.suppress().Mads Jensen
2017-06-21Reorganized backends tests.Mariusz Felisiak
2017-06-13Fixed #27830 -- Used distutils.version.LooseVersion for version parsing.chillaranand
2017-06-01Refs #23968 -- Removed unnecessary lists, generators, and tuple calls.Jon Dufresne
2017-05-27Fixed #28249 -- Removed unnecessary dict.keys() calls.Jon Dufresne
iter(dict) is equivalent to iter(dict.keys()).
2017-05-23Refs #27859 -- Added DatabaseWrapper.display_name.Mariusz Felisiak
Thanks Tim Graham for the review.
2017-03-01Removed PostgreSQL version detection for psycopg2 < 2.0.12.Tim Graham