Commit Graph

131 Commits

Author SHA1 Message Date
Mariusz Felisiak 2a038521c4
Fixed #31271 -- Preserved ordering when unifying query parameters on Oracle.
This caused misplacing parameters in logged SQL queries.

Regression in 79065b55a7.

Thanks Hans Aarne Liblik for the report.
2020-02-18 11:45:12 +01:00
Jon Dufresne 3259983f56 Fixed #31233 -- Closed database connections and cursors after use. 2020-02-06 15:35:23 +01:00
Matthijs Kooijman 2a2ea4ee18 Refs #31117 -- Made various tests properly handle unexpected databases aliases.
- 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.
2020-01-20 14:39:02 +01:00
Mariusz Felisiak ed880d92b5
Added tests for queries log in CursorDebugWrapper.executemany(). 2019-04-29 10:38:17 +02:00
Mariusz Felisiak 79065b55a7
Refs #20010 -- Unified DatabaseOperations.last_executed_query() on Oracle with other db backends.
Thanks Simon Charette for the review.
2019-04-05 21:35:51 +02:00
Jon Dufresne 76990cbbda Fixed #30171 -- Fixed DatabaseError in servers tests.
Made DatabaseWrapper thread sharing logic reentrant. Used a reference
counting like scheme to allow nested uses.

The error appeared after 8c775391b7.
2019-02-14 10:04:55 -05:00
Sergey Fedoseev b1a2ad6925 Removed uneeded iter() calls with generator expression as argument. 2019-02-09 09:18:22 -05:00
Nick Pope 83677faf86 Fixed #30056 -- Added SQLite support for StdDev and Variance functions. 2018-12-24 11:14:58 -05:00
Nick Pope 7534e43497 Refs #14204 -- Removed obsolete referential integrity comment for SQLite. 2018-12-22 18:44:21 -05:00
Mariusz Felisiak d5f4ce9849
Fixed #29949 -- Refactored db introspection identifier converters.
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-11-21 09:06:50 +01:00
Morgan Aubert 704443acac Fixed #29363 -- Added SimpleTestCase.assertWarnsMessage(). 2018-05-09 11:40:28 -04:00
Jon Dufresne 7a6fbf36b1 Fixed #28853 -- Updated connection.cursor() uses to use a context manager. 2017-11-28 11:28:09 -05:00
Tim Graham 6e4c6281db Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()."
This reverts commit 550cb3a365
because try/except performs better.
2017-09-07 08:16:21 -04:00
Mads Jensen 550cb3a365 Fixed #27818 -- Replaced try/except/pass with contextlib.suppress(). 2017-06-28 14:07:55 -04:00
Mariusz Felisiak 8cb1b1fd8e Reorganized backends tests. 2017-06-21 12:00:47 -04:00
chillaranand 08bda82c23 Fixed #27830 -- Used distutils.version.LooseVersion for version parsing. 2017-06-13 10:53:39 -04:00
Jon Dufresne 2c69824e5a Refs #23968 -- Removed unnecessary lists, generators, and tuple calls. 2017-06-01 19:08:59 -04:00
Jon Dufresne 21046e7773 Fixed #28249 -- Removed unnecessary dict.keys() calls.
iter(dict) is equivalent to iter(dict.keys()).
2017-05-27 19:08:46 -04:00
Mariusz Felisiak b3eb6eaf1a Refs #27859 -- Added DatabaseWrapper.display_name.
Thanks Tim Graham for the review.
2017-05-23 09:09:35 -04:00
Tim Graham 29ea9714ee Removed PostgreSQL version detection for psycopg2 < 2.0.12. 2017-03-01 13:17:34 -05:00
Tim Graham 49a63d08d3 Fixed a backends test with psycopg2 2.7. 2017-03-01 13:14:35 -05:00
Vytis Banaitis d1bab24e01 Refs #23919, #27778 -- Removed obsolete mentions of unicode. 2017-01-26 08:19:27 -05:00
Tim Graham 7aba69145d Refs #23919 -- Removed django.test.mock Python 2 compatibility shim. 2017-01-20 08:17:20 -05:00
Simon Charette cecc079168 Refs #23919 -- Stopped inheriting from object to define new style classes. 2017-01-19 08:39:46 +01:00
Claude Paroz 2b281cc35e Refs #23919 -- Removed most of remaining six usage
Thanks Tim Graham for the review.
2017-01-18 21:33:28 +01:00
Claude Paroz 7b2f2e74ad Refs #23919 -- Removed six.<various>_types usage
Thanks Tim Graham and Simon Charette for the reviews.
2017-01-18 20:18:46 +01:00
Claude Paroz d7b9aaa366 Refs #23919 -- Removed encoding preambles and future imports 2017-01-18 09:55:19 +01:00
Tim Graham fae56427e1 Fixed #27649 -- Bumped required cx_Oracle to 5.2.
Removed obsolete workarounds from 1aa4889808
and dcf3be7a62.
2016-12-29 12:45:25 -05:00
Tim Graham e744c7e459 Imported specific models in a few tests that didn't. 2016-12-08 11:14:15 -05:00
Tim Graham b5f0b3478d Fixed #27579 -- Added aliases for Python 3's assertion names in SimpleTestCase. 2016-12-07 17:42:31 -05:00
za 321e94fa41 Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings. 2016-11-10 21:30:21 -05:00
Chris Jerdonek 7ca3b391b6 Fixed #27170 -- Added DatabaseWrapper class attributes to ease subclassing. 2016-09-08 16:33:36 -04:00
Simon Charette 9fed4ec418 Removed an obsolete comment about a fixed ticket. 2016-05-21 15:42:38 -04:00
Tim Graham 92053acbb9 Fixed E128 flake8 warnings in tests/. 2016-04-08 10:12:33 -04:00
Tim Graham 97eb3356b2 Fixed #26177 -- Fixed a PostgreSQL crash with TIME_ZONE=None and USE_TZ=False. 2016-02-08 07:21:54 -05:00
Hasan 3d0dcd7f5a Refs #26022 -- Used context manager version of assertRaises in tests. 2016-01-29 12:32:18 -05:00
Aymeric Augustin f91b5a7e4b Fixed #26063 -- Crash when passing > 2000 params.
If SQLITE_MAX_VARIABLE_NUMBER (default = 999) is changed at compile time
to be greater than SQLITE_MAX_COLUMN (default = 2000), which Debian does
by setting the former to 250000, Django raised an exception on queries
containing more than 2000 parameters when DEBUG = True.
2016-01-21 10:47:15 +01:00
Simon Charette 1c5f4e86bc Fixed #25745 -- Promoted RuntimeWarnings to errors in the test suite. 2015-11-14 11:33:28 -05:00
Riccardo Magliocchetti 3543fec3b7 Refs #12118 -- Allowed "mode=memory" in SQLite test database names. 2015-10-06 12:32:05 -04:00
Aymeric Augustin 4f6a7663bc Refs #14091 -- Fixed connection.queries on SQLite. 2015-09-17 23:01:33 +02:00
Dražen Odobašić b1e33ceced Fixed #23395 -- Limited line lengths to 119 characters. 2015-09-12 11:40:50 -04:00
Adam Chainz b2f6e421a3 Fixed #25329 -- Prevented _nodb_connection from being left open 2015-09-11 08:40:43 +02:00
Aymeric Augustin 05cea7fdbb Changed database connection duplication technique.
This new technique is more straightforward and compatible with test
parallelization, where the effective database connection settings no
longer match settings.DATABASES.
2015-09-09 23:03:51 +02:00
Maxime Lorant 5153a3bfdc Fixed #25331 -- Removed trailing blank lines in docstrings. 2015-08-31 17:37:21 -04:00
Caio Ariede ec9004728e Fixed #25175 -- Renamed the postgresql_psycopg2 database backend to postgresql. 2015-08-07 09:33:17 -04:00
Shai Berger 071801ccff Cleanup: Removed the try-except-fail antipattern from tests
Found cases where testing code was doing

    try:
        whatever
    except (some excption type):
        self.fail("exception shouldn't be thrown")

replaced it with just

    whatever

as this makes the unexpected errors easier to debug, and the tests
would fail just as much and aren't rendered less readable.

Thanks Markus Holtermann for review
2015-06-05 12:57:20 +03:00
Simon Charette be67400b47 Refs #24652 -- Used SimpleTestCase where appropriate. 2015-05-20 13:46:13 -04:00
Aymeric Augustin ed83881e64 Fixed #23820 -- Supported per-database time zone.
The primary use case is to interact with a third-party database (not
primarily managed by Django) that doesn't support time zones and where
datetimes are stored in local time when USE_TZ is True.

Configuring a PostgreSQL database with the TIME_ZONE option while USE_TZ
is False used to result in silent data corruption. Now this is an error.
2015-05-17 09:40:28 +02:00
Claude Paroz 3226050358 Fixed #24791 -- Added fallback when 'postgres' database isn't available
Thanks Carl Meyer and Tim Graham for the reviews.
2015-05-15 18:44:20 +02:00
Anssi Kääriäinen 8f30556329 Renamed Field.rel attribute to remote_field
Field.rel is now deprecated. Rel objects have now also remote_field
attribute. This means that self == self.remote_field.remote_field.

In addition, made the Rel objects a bit more like Field objects. Still,
marked ManyToManyFields as null=True.
2015-03-25 08:16:12 -04:00