Commit Graph

68 Commits

Author SHA1 Message Date
Matthijs Kooijman 4f216e4f8e Fixed #31051 -- Allowed dumpdata to handle circular references in natural keys.
Since #26291 forward references in natural keys are properly handled by
loaddata, so sorting depenencies in dumpdata doesn't need to break on
cycles. This patch allows circular references in natural keys by
breaking sort_depenencies() on loops.
2020-04-07 20:41:59 +02:00
Matthijs Kooijman 26799c6503 Refs #26291 -- Added tests for dumpdata/loaddata with forward references without natural keys. 2020-04-07 15:40:19 +02:00
Matthijs Kooijman fca36f3c98 Refs #26291 -- Added tests for dumpdata with forward references in natural keys. 2020-04-07 15:40:14 +02:00
Matthijs Kooijman 481d8fc324 Refs #31051 -- Added test for loaddata/dumpdata with circular references without natural keys. 2020-04-07 12:01:19 +02:00
Hasan Ramezani fc4f45ebdc Used assertRaisesMessage() in various tests. 2020-02-07 12:46:23 +01:00
Jon Dufresne 3259983f56 Fixed #31233 -- Closed database connections and cursors after use. 2020-02-06 15:35:23 +01:00
Jon Dufresne 39791c8e6d Harmonized Windows checks in tests to a single style. 2019-11-06 15:14:30 +01:00
Markus Holtermann da0b2554ec Renamed camelCaseTestMethods to snake_case_test_methods 2019-04-14 16:14:14 +02:00
Jon Dufresne 7e3bf2662b Removed default mode='r' argument from calls to open(). 2019-01-27 17:41:43 -05:00
Tim Graham 0004daa536
Used 4 space hanging indent for dictionaries.
Thanks Mariusz Felisiak for auditing.
2019-01-02 18:18:19 -05:00
Peter Inglesby 312eb5cb11 Fixed #26291 -- Allowed loaddata to handle forward references in natural_key fixtures. 2018-07-13 17:54:47 -04:00
Morgan Aubert 704443acac Fixed #29363 -- Added SimpleTestCase.assertWarnsMessage(). 2018-05-09 11:40:28 -04:00
Mariusz Felisiak 362813d628
Fixed hanging indentation in various code. 2018-03-16 10:54:34 +01:00
Дилян Палаузов d7b2aa24f7 Fixed #28982 -- Simplified code with and/or. 2018-01-03 20:12:23 -05:00
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) 58ec55b157 Fixed #28117 -- Added a helpful message in loaddata when psycopg2 can't load a fixture due to NUL characters. 2017-12-30 12:16:11 -05:00
Chandrakant Kumar f6800a081a Refs #27787 -- Corrected or removed invalid call_command() options. 2017-06-16 11:06:01 -04:00
Pavel Kulikov af1fa5e7da Fixed #27978 -- Allowed loaddata to read data from stdin.
Thanks Squareweave for the django-loaddata-stdin project from which this
is adapted.
2017-05-26 19:54:21 -04:00
Tim Graham 29f607927f Fixed spelling of "nonexistent". 2017-02-03 08:01:45 -05:00
Claude Paroz 2366100872 Removed unneeded force_text calls in the test suite 2017-01-24 18:45:54 +01: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 d7b9aaa366 Refs #23919 -- Removed encoding preambles and future imports 2017-01-18 09:55:19 +01:00
Simon Charette 91023d79ec Removed available_apps on TestCase subclasses.
TestCase subclasses are wrapped in a transaction that prevents any data from
being persisted between test runs andi thus don't require limiting the tables
to be flushed to a subset of available apps like TransactionTestCase subclasses
do.
2017-01-13 08:50:03 -05:00
Simon Charette dc1193085d Made contenttypes and auth apps unavailable when not necessary in tests. 2017-01-13 08:50:03 -05:00
za 321e94fa41 Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings. 2016-11-10 21:30:21 -05:00
Claude Paroz 599393172b Fixed #26826 -- Stripped spaces from dumpdata pks arguments
Thanks Kevin Graham Foster for the report and Tim Graham for the review.
2016-07-16 20:49:10 +02:00
Berker Peksag ae2a7da86b Fixed #20468 -- Added loaddata --exclude option.
Thanks Alex Morozov for the initial patch.
2016-06-09 10:35:32 -04:00
Tim Graham 92053acbb9 Fixed E128 flake8 warnings in tests/. 2016-04-08 10:12:33 -04:00
Jon Dufresne cacc7e85e1 Fixed test_dumpdata_progressbar to use the instantiated StringIO object. 2016-03-14 10:28:40 -04:00
Yoong Kang Lim 0edb8a146f Fixed #26144 -- Warned when dumping proxy model without concrete parent. 2016-02-04 19:40:12 -05:00
Hasan 26ad01719d Refs #26022 -- Replaced six.assertRaisesRegex with assertRaisesMessage as appropriate. 2016-01-29 13:37:33 -05:00
Andrew Kuchev d5b90c8e12 Fixed #21549 -- Made loaddata's 'fixture not found' warning an exception.
Thanks to mpasternak for the report and Tim Graham for the review.
2016-01-04 19:39:35 -05:00
Anssi Kääriäinen ee9f4686b1 Fixed #23372 -- Made loaddata faster if it doesn't find any fixtures.
Django's test suite often tries to load fixture files from apps that have
no fixtures at all. This creates a lot of unnecessary disabling and
enabling of constraints which can be expensive on some database.

To speed this up, loaddata now first checks if any fixture file matches.
If no fixture file is matched, then the command exits before disabling
and enabling of constraints is done.

The main benefit of this change is seen on MSSQL, where tests on
Django 1.8 run hours faster.
2015-12-31 09:00:44 -05:00
Dražen Odobašić b1e33ceced Fixed #23395 -- Limited line lengths to 119 characters. 2015-09-12 11:40:50 -04:00
Tim Graham eaa3c88345 Refs #22258 -- Fixed an unclosed temporary file in fixtures test.
This prevented the temporary directory from being removed
on Windows.
2015-09-09 14:35:51 -04:00
Claude Paroz c296e55dc6 Fixed #22258 -- Added progress status for dumpdata when outputting to file
Thanks Gwildor Sok for the report and Tim Graham for the review.
2015-07-24 18:37:55 +02:00
Gagaro 8b7bd62ae5 Refs #24978 -- Amended test filename to avoid checkout warnings on Windows. 2015-06-20 14:22:57 -04:00
Tim Graham 81aae28843 Refs #24978 -- Skipped an unsupported test on Windows. 2015-06-17 10:22:08 -04:00
Moritz Sichert 98df288dda Fixed #24978 -- Escaped special characters in loaddata fixture paths 2015-06-13 19:45:05 -04:00
Peter Inglesby 0688a7946a Fixed #24776 -- Improved apps.get_app_config() error message on fully-qualified package names. 2015-05-22 11:08:25 -04:00
Tim Graham 33b1635a90 Fixed fixtures tests failure on Python 2 with non-ASCII path. 2015-04-16 13:44:07 -04:00
Yitzhak Clark 188a241880 Fixed #21652 -- Added notification when processing objects in loaddata
Added a running count of the objects processed by loaddata when
verbosity >= 3.
2015-04-16 09:42:18 -04:00
Aymeric Augustin 90b069c33f Prevented some tests from writing in the CWD. 2015-03-07 15:56:15 +01:00
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Tim Graham 67235fd4ef Removed support for initial_data fixtures per deprecation timeline. 2015-01-17 09:59:25 -05:00
Daniel Pyrathon fb48eb0581 Fixed #12663 -- Formalized the Model._meta API for retrieving fields.
Thanks to Russell Keith-Magee for mentoring this Google Summer of
Code 2014 project and everyone else who helped with the patch!
2015-01-06 19:25:12 -05:00
Claude Paroz 51890ce889 Applied ignore_warnings to Django tests 2014-12-30 18:16:25 +01:00
Claude Paroz 7a893ee771 Fixed #23651 -- Isolated non-existent fixture tests
Previous versions of the tests were buggy, as initial_data.json
did exist and the test wasn't failing. It was finally failing on
Python 3.4.2.
Thanks Raphaël Hertzog for the report (and Debian bug #765117
contributors).
2014-10-15 09:17:44 +02:00
Tim Graham f53b1c779b Fixed #23099 -- Removed usage of deprecated initial data in Django's test suite.
Thanks Claude Paroz for assistance with debugging the tests.
2014-08-08 14:01:59 -04:00