Commit Graph

220 Commits

Author SHA1 Message Date
Claude Paroz 3c5d1edb39 Fixed #22279 -- Prevented dummy backend going through DatabaseErrorWrapper
Thanks Daniel Hahler for the report and Tim Graham for the review.
2014-12-29 19:06:28 +01:00
Claude Paroz 30cbd5d360 Replaced DatabaseCreation sql methods by schema editor equivalents
Also used schema editor in migrate to sync unmigrated apps (sync_apps).
Refs #22340. Thanks Tim Graham for the review.
2014-12-23 19:35:01 +01:00
Michael Hall 895dc880eb Fixed #23812 -- Changed django.utils.six.moves.xrange imports to range 2014-12-13 12:45:58 -05:00
Josh Smeaton 267a1dcd9b Fixed #23941 -- Removed implicit decimal formatting from expressions. 2014-12-12 10:17:48 -05:00
Thomas Chaumeny da9fe5c717 Fixed #20392 -- Added TestCase.setUpTestData()
Each TestCase is also now wrapped in a class-wide transaction.
2014-12-03 10:37:04 -05:00
Andriy Sokolovskiy 1739ae9edc Fixed #23807 -- Ignored non-digits in psycopg2 version 2014-12-01 18:42:08 -05:00
Veres Lajos a71a2ea756 Fixed typos using https://github.com/vlajos/misspell_fixer 2014-11-03 20:59:30 -05:00
Berker Peksag f7969b0920 Fixed #23620 -- Used more specific assertions in the Django test suite. 2014-11-03 11:56:37 -05:00
Claude Paroz abc11b0a33 Fixed #23514 -- Prevented queries in PostGISOperations init
Thanks Mattia Procopio for the report.
2014-09-18 20:00:35 +02:00
Marc Tamlyn e9103402c0 Fixed #18757, #14462, #21565 -- Reworked database-python type conversions
Complete rework of translating data values from database

Deprecation of SubfieldBase, removal of resolve_columns and
convert_values in favour of a more general converter based approach and
public API Field.from_db_value(). Now works seamlessly with aggregation,
.values() and raw queries.

Thanks to akaariai in particular for extensive advice and inspiration,
also to shaib, manfre and timograham for their reviews.
2014-09-03 20:36:03 +01:00
Tim Graham d28396f526 Fixed #23144 -- Dropped support for MySQL 5.0, 5.1. 2014-08-02 10:28:40 -04:00
Tim Graham a9bdce7e55 Fixed #23108 -- Dropped support for PostgreSQL 8.4 & PostGIS 1.3, 1.4.
Thanks Claude Paroz for the review.
2014-08-01 10:26:00 -04:00
Anubhav Joshi 91f1b6dcdc Fixed #13711 -- Model check added to ensure that auto-generated column name is within limits of the database.
Thanks russellm for report and Tim Graham for review.
2014-06-17 16:16:02 -04:00
Tim Graham a2cd0e12c9 Silenced deprecation warnings for refs #22811 and fixed build. 2014-06-12 09:28:36 -04:00
Tim Graham 1c58cabad7 Fixed #22811 -- Allowed setting both the old and new TEST database settings.
An ImproperlyConfigured exception will be raised they mismatch.
2014-06-12 08:17:49 -04:00
Tim Graham 6c27ff957a Fixed flake8 error. 2014-06-07 20:35:28 -04:00
Aymeric Augustin fc31319752 Fixed test again. Refs #12581. 2014-06-07 17:16:49 +02:00
Aymeric Augustin d98cc41a84 Made a test compatible with Python 2 and 3. 2014-06-07 15:04:06 +02:00
Aymeric Augustin cfcca7ccce Fixed #3711, #6734, #12581 -- Bounded connection.queries.
Prevented unlimited memory consumption when running background tasks
with DEBUG=True.

Thanks Rob, Alex, Baptiste, and others.
2014-06-07 14:37:43 +02:00
Aymeric Augustin 237c229b91 Avoided using BinaryField unecessarily in tests.
Several database backends struggle with binary data. This change
minimizes the risk of unrelated tests failures when binary fields
trigger errors.

Forward-port of 2e4bcb9b from stable/1.7.x.
2014-06-05 17:11:10 +02:00
Aymeric Augustin c70a61eb49 Replaced vendor checks by three feature flags. 2014-05-08 22:11:15 +02:00
Aymeric Augustin d667263169 Reorganized backends tests.
This reduces the number of explicit vendor checks.
2014-05-08 21:50:21 +02:00
Aymeric Augustin 8176150850 Fixed #21202 -- Maintained atomicity when the server disconnects.
Thanks intgr for the report.

This commit doesn't include a test because I don't know how to emulate a
database disconnection in a cross-database compatible way.

Also simplified a 'backends' test that was constrained by this problem.
2014-04-10 21:22:47 +02:00
Aymeric Augustin 5f2f47fdfc Fixed #21553 -- Ensured unusable database connections get closed. 2014-04-09 22:41:33 +02:00
Aymeric Augustin 2791fbf59d Used more specific test assertions. 2014-04-09 22:20:22 +02:00
Claude Paroz d902fd625d Added test to confirm #12583 resolution 2014-03-31 18:24:01 +02:00
Aymeric Augustin 0f9560855e Removed legacy transaction management per the deprecation timeline. 2014-03-21 21:06:50 +01:00
Rodolfo Carvalho 0d91225892 Fixed many typos in comments and docstrings.
Thanks Piotr Kasprzyk for help with the patch.
2014-03-03 07:38:09 -05:00
Vajrasky Kok d3cf6cfacf Fixed #17713 -- Renamed BaseDatabaseFeatures.allows_primary_key_0 to allows_auto_pk_0.
MySQL does allow primary key with value 0. It only forbids autoincrement
primary key with value 0.

Thanks Claude Paroz for the report.
2014-02-06 05:16:40 -05:00
Aymeric Augustin ab922c5cd8 Fixed typo in 3ffeb931. 2014-02-02 23:40:16 +01:00
Michael Manfre 3ffeb93186 Ensure cursors are closed when no longer needed.
This commit touchs various parts of the code base and test framework. Any
found usage of opening a cursor for the sake of initializing a connection
has been replaced with 'ensure_connection()'.
2014-02-02 12:47:21 -05:00
Michael Manfre 0837eacc4e Made SQLCompiler.execute_sql(result_type) more explicit.
Updated SQLUpdateCompiler.execute_sql to match the behavior described in
the docstring; the 'first non-empty query' will now include all queries,
not just the main and first related update.

Added CURSOR and NO_RESULTS result_type constants to make the usages more
self documenting and allow execute_sql to explicitly close the cursor when
it is no longer needed.
2014-02-02 12:47:06 -05:00
Simon Charette 10e3faf191 Fixed #19774 -- Deprecated the contenttypes.generic module.
It contained models, forms and admin objects causing undesirable
import side effects. Refs #16368.

Thanks to Ramiro, Carl and Loïc for the review.
2014-01-26 14:42:30 -05:00
Aymeric Augustin 225a6ed2cf Fixed a test that was failing with PostGIS.
Fixed #21452 again.

Forward-port of 18d75e07 from stable/1.6.x.
2014-01-12 21:40:22 +01:00
Aymeric Augustin 720c6d3a44 Restored a test broken by overzealous PEP8 cleanup 2014-01-12 21:13:32 +01:00
Simon Charette c726598c3d Fixed flake8 issues. 2014-01-12 13:40:37 -05:00
Aymeric Augustin 1afe748832 Fixed #21452 -- Non-autocommit connections to PostgreSQL.
When settings.DATABASES['default']['AUTOCOMMIT'] = False, the connection
wasn't in autocommit mode but Django pretended it was.

Thanks Anssi for analysing this issue.

Refs #17062.
2014-01-12 18:28:51 +01:00
Aymeric Augustin 1c24096f1e Fixed a test isolation issue. Refs #17062.
This test could change settings.DATABASES['default']['TIME_ZONE'] and
didn't restore the previous value.
2014-01-12 18:28:51 +01:00
Aymeric Augustin e32095616c Imported override_settings from its new location. 2013-12-23 21:37:56 +01:00
Jason Myers 7a61c68c50 PEP8 cleanup
Signed-off-by: Jason Myers <jason@jasonamyers.com>
2013-11-02 23:50:49 -05:00
Tim Graham ae48d77ef8 Fixed E225 pep8 warnings. 2013-10-23 06:09:29 -04:00
Anssi Kääriäinen 47e79bfcfb Fixed #21187 -- Import CursorWrapper from django.db.backend.utils
The import was done from util instead of utils leading to
PendingDeprecationWarning.
2013-09-28 14:18:37 +03:00
Michael Manfre 99c87f1410 Fixed #17671 - Cursors are now context managers. 2013-09-25 21:47:26 +03:00
Tim Graham 18ffdb1772 Fixed #17627 -- Renamed util.py files to utils.py
Thanks PaulM for the suggestion and Luke Granger-Brown and
Wiktor Kołodziej for the initial patch.
2013-09-16 12:52:05 -04:00
Alex Gaynor 97a626d898 Fixed this syntax error on py32 2013-09-06 21:56:57 -07:00
Eric Boersma ded40142a9 Fixed #20007 -- Configured psycopg2 to return UnicodeArrays
Thanks hogbait for the report.
2013-09-06 20:43:58 -04:00
Chris Wilson eade315da1 Fixed #10164 -- Made AutoField increase monotonically on SQLite
Thanks malte for the report.
2013-09-06 12:31:17 -04:00
Eric Boersma 4d13cc56de Fixed #21035 -- Changed docs to treat the acronym SQL phonetically.
The documentation and comments now all use 'an' to
refer to the word SQL and not 'a'.
2013-09-05 20:14:58 -04:00
Simon Charette 11cd7388f7 Fixed #20989 -- Removed useless explicit list comprehensions. 2013-08-30 10:57:51 -04:00
Tim Graham aa830009de Fixed #17519 -- Fixed missing SQL constraints to proxy models.
Thanks thibaultj for the report, jenh for the patch,
and charettes for the tests.
2013-08-02 07:41:56 -04:00
Claude Paroz 5c1143910e Removed most of absolute_import imports
Should be unneeded with Python 2.7 and up.
Added some unicode_literals along the way.
2013-07-29 20:28:13 +02:00
Aymeric Augustin 38bc581bc0 Avoided transaction.set_autocommit in tests.
It doesn't work as one might expect on a certain database backend where
autocommits_when_autocommit_is_off = True. That backend happens to be
popular for running tests.
2013-07-09 21:41:30 +02:00
Aymeric Augustin e021b87c00 Fixed a few more imports of django.utils.unittest.
One import per line please! Refs #20680.
2013-07-01 22:49:07 +02:00
Claude Paroz 59b0c48ce2 Fixed #18592 -- Prevented crash when accessing MySQL _last_executed
Thanks reames at asymmetricventures.com for the report.
2013-06-29 18:44:41 +02:00
Shai Berger d097417025 Support 'pyformat' style parameters in raw queries, Refs #10070
Add support for Oracle, fix an issue with the repr of RawQuerySet,
add tests and documentations. Also added a 'supports_paramstyle_pyformat'
database feature, True by default, False for SQLite.

Thanks Donald Stufft for review of documentation.
2013-06-28 06:59:10 +03:00
Gilberto Gonçalves 680b512fc1 Fixed #20587 -- Made convert_values handle None values 2013-06-22 14:05:12 +01:00
Aymeric Augustin c6e6d4eeb7 Defined available_apps in relevant tests.
Fixed #20483.
2013-06-10 11:30:01 +02:00
Claude Paroz 499a745ae1 Fixed #20474 -- Proxied and deprecated django.db.backend 2013-05-23 15:19:12 +02:00
Marc Tamlyn 09f8652765 Use assertIsInstance in tests.
Gives much nicer errors when it fails.
2013-05-21 10:42:15 +01:00
Shai Berger 9ef4d177d1 Fixed #20388 -- Test failures under Oracle.
Add "FROM DUAL" to SQL selecting constants in tests for Oracle.
2013-05-16 15:00:16 +02:00
Claude Paroz 3ff3212713 Fixed #19220 -- Prevented decimals to be displayed in scientific notation
Thanks nebstrebor for the report and antofik for the patch.
2013-03-31 22:39:01 +02:00
Claude Paroz 86b1c31689 Fixed #19954 -- Fixed MySQL _last_executed decoding
Queries can contain binary data undecodable with utf-8. In this
case, using the 'replace' errors mode when decoding seems like
an acceptable representation of the query.
Thanks Marcel Ryser for the report.
2013-03-28 20:08:37 +01:00
Claude Paroz 76aecfbc4b Fixed #9055 -- Standardized behaviour of parameter escaping in db cursors
Previously, depending on the database backend or the cursor type,
you'd need to double the percent signs in the query before passing
it to cursor.execute. Now cursor.execute consistently need percent
doubling whenever params argument is not None (placeholder substitution
will happen).
Thanks Thomas Güttler for the report and Walter Doekes for his work
on the patch.
2013-03-23 17:11:10 +01:00
Aymeric Augustin 55a9be8ecf Ran a test that closes the database connection outside of a transaction. 2013-03-11 19:42:59 +01:00
Aymeric Augustin e654180ce2 Improved the API of set_autocommit. 2013-03-11 15:10:58 +01:00
Aymeric Augustin 7c46c8d5f2 Added some assertions to enforce the atomicity of atomic. 2013-03-11 14:48:55 +01:00
Aymeric Augustin af9e9386eb Enabled autocommit for PostgreSQL.
For users who didn't activate autocommit in their database options, this
is backwards-incompatible in "non-managed" aka "auto" transaction state.
This state now uses database-level autocommit instead of ORM-level
autocommit.

Also removed the uses_autocommit feature which lost its purpose.
2013-03-11 14:48:54 +01:00
Alex Gaynor bbbd698c7a Added a ManyToManyField(db_constraint=False) option, this allows not creating constraints on the intermediary models. 2013-03-07 11:24:51 -08:00
Aymeric Augustin 7aaa8a7779 Fixed a test that relied on database exceptions not being wrapped. 2013-02-27 21:12:48 +01:00
Florian Apolloner 89f40e3624 Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00