Commit Graph

16 Commits

Author SHA1 Message Date
Mariusz Felisiak 4261907ff3 Fixed tests when run in reverse.
Regression in 98f23a8af0.
2020-02-19 14:48:26 +01:00
Matthijs Kooijman 98f23a8af0 Fixed #26552 -- Deferred constraint checks when reloading the database with data for tests.
deserialize_db_from_string() loads the full serialized database
contents, which might contain forward references and cycles. That
caused IntegrityError because constraints were checked immediately.

Now, it loads data in a transaction with constraint checks deferred
until the end of the transaction.
2020-02-14 13:18:06 +01:00
Matthijs Kooijman b64b1b2e1a Fixed #31117 -- Isolated backends.base.test_creation.TestDbCreationTests.
Previously, this test could modify global state by changing
connection.settings_dict. This dict is a reference to the same dict as
django.db.connections.databases['default'], which is thus also changed.
The cleanup of this test would replace connection.settings_dic` with a
saved copy, which would leave the dict itself modified.

Additionally, create_test_db() would also modify these same dicts, as
well as settings.databases['default']['NAME'] by adding a "test_"
prefix, which is what can cause problems later.

This patch:
 - makes a complete copy of the connection and work on that, to improve
   isolation.
 - calls destroy_test_db() to let that code clean up anything done by
   create_test_db().
2020-01-20 11:00:17 +01:00
Mariusz Felisiak f34be5294d Refs #31117 -- Moved get_connection_copy() test hook to a module level. 2020-01-20 11:00:05 +01:00
Jon Dufresne f5ebdfce5c Fixed #25388 -- Added an option to allow disabling of migrations during test database creation. 2019-11-20 20:42:38 +01:00
Ville Skyttä 03db5fddfd Fixed typos in docs, comments, and exception messages. 2019-04-18 09:33:53 +02:00
Simon Charette b181aba7dd Refs #28478 -- Prevented database feature based skipping on tests disallowing queries.
Database features may require a connection to be established to determine
whether or not they are enabled.
2019-01-14 16:16:30 -05:00
Tim Graham 193c109327 Switched TestCase to SimpleTestCase where possible in Django's tests. 2018-11-27 08:58:44 -05:00
Tim Graham 9cac10eee4 Added BaseDatabaseSchemaEditor._effective_default() to allow testing without a connection. 2018-11-17 19:27:53 -05:00
Tim Graham e62f6e0968 Fixed #29505 -- Removed SchemaEditor's calling of callable defaults.
Thanks Eugene Pakhomov for the suggested fix.
2018-11-17 19:27:53 -05:00
Jon Dufresne 7598cd4748 Fixed #29813 -- Fixed DatabaseOperation test when run in isolation on MySQL. 2018-10-02 08:22:38 -04:00
Matthew Wilkes 2162f0983d Fixed #24747 -- Allowed transforms in QuerySet.order_by() and distinct(*fields). 2018-02-10 19:08:55 -05:00
Mads Jensen 41406bf98e Increased test coverage for db/backends/base/operations.py. 2017-09-30 19:48:55 -04:00
Shai Berger d612026c37 Refs #28595 -- Added a hook to add execute wrappers for database queries.
Thanks Adam Johnson, Carl Meyer, Anssi Kääriäinen, Mariusz Felisiak,
Michael Manfre, and Tim Graham for discussion and review.
2017-09-21 12:13:09 -04:00
Mads Jensen d549b88050 Fixed #26608 -- Added support for window expressions (OVER clause).
Thanks Josh Smeaton, Mariusz Felisiak, Sergey Fedoseev, Simon Charettes,
Adam Chainz/Johnson and Tim Graham for comments and reviews and Jamie
Cockburn for initial patch.
2017-09-18 09:42:29 -04:00
Mariusz Felisiak 8cb1b1fd8e Reorganized backends tests. 2017-06-21 12:00:47 -04:00