Commit Graph

48 Commits

Author SHA1 Message Date
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
Flavio Curella c2e70f0265 Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField 2015-07-27 18:28:13 -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
Loic Bistuer 2f3a4cd573 Removed numbering from the models.py header of some test packages.
This is a reliqua from the early days of the modeltests/regressiontests era.
2014-09-24 17:28:56 +07: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
Alex Gaynor 92dbf34286 Ensure that a file is closed in the tests 2014-03-30 11:50:18 -07:00
Anubhav Joshi f34e8fc890 Fixed #22257 -- Added file output option to dumpdata command. 2014-03-25 13:47:03 +05:30
Claude Paroz c564277937 Fixed #22237 -- Removed some warnings in the test suite
Thanks Aymeric Augustin for the report.
2014-03-09 22:10:49 +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
Eli Bendersky 73f51e4113 Fixed #22025 -- Listing app followed by app.Model in dumpdata command
When invoked as follows:

  $ python manage.py dumpdata blogapp blogapp.Tag

Django would throw a TypeError. This commit fixes the problem and provides
a test.
2014-02-12 15:34:26 +01:00
Andrew Godwin d5df7a0515 Fixed #21969: Fix behaviour of initial_data with migrated apps 2014-02-09 12:22:59 +00: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
Jason Myers 7a61c68c50 PEP8 cleanup
Signed-off-by: Jason Myers <jason@jasonamyers.com>
2013-11-02 23:50:49 -05:00
Alasdair Nicol c3aa2948c6 Fixed #21298 -- Fixed E301 pep8 warnings 2013-10-23 13:45:03 +01:00
Tai Lee e527c0b6d8 Fixed #13252 -- Added ability to serialize with natural primary keys.
Added ``--natural-foreign`` and ``--natural-primary`` options and
deprecated the ``--natural`` option to the ``dumpdata`` management
command.

Added ``use_natural_foreign_keys`` and ``use_natural_primary_keys``
arguments and deprecated the ``use_natural_keys`` argument to
``django.core.serializers.Serializer.serialize()``.

Thanks SmileyChris for the suggestion.
2013-10-11 12:52:57 -04:00
Tim Graham 1dae4ac177 Whitespace cleanup.
* Removed trailing whitespace.
* Added newline to EOF if missing.
* Removed blank lines at EOF.
* Removed some stray tabs.
2013-10-10 16:49:20 -04:00
Baptiste Mispelon abb10db06f Fixed #21089 -- Allow TransactionTestcase subclasses to define an empty list of fixtures.
Thanks to lgs for the report and initial patch.
2013-09-11 15:28:04 +02:00
Florian Apolloner df2fd4e09b Removed unneeded imports in tests's __init__.py and unified them. 2013-09-09 23:01:07 +02:00
Tim Graham 3db66b1d65 Updated syncdb -> migrate in tests. 2013-09-03 11:51:34 -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 2c40681805 Stopped calling loaddata with commit=False.
This was a stealth option only used by the tests, and it isn't useful
any more since `atomic` provides nested transactions.
2013-06-30 14:17:33 +02:00
Aymeric Augustin c6e6d4eeb7 Defined available_apps in relevant tests.
Fixed #20483.
2013-06-10 11:30:01 +02:00
Tim Graham 59235816bd Fixed #20509 - Proper parsing for dumpdata --pks option.
Thanks weipin for the report and Baptiste Mispelon for the patch.
2013-05-30 10:19:13 -04:00
Anssi Kääriäinen 190771d003 Fixed fixtures testing failure
The failure was caused by generating the same warning from two tests.
The second time the same warning was raised it was swallowed by the
"once" simplefilter of warnings.
2013-05-19 20:53:49 +03:00
Preston Holmes 6786920fd8 Fixed #16330 -- added --pks option in dumpdata command
Thanks to guettli for the initial ticket and patch, with additional work
from mehmetakyuz and Kevin Brolly.
2013-05-19 09:10:40 -07:00
Senko Rasic c44a2c40fe Fixed #18990 -- Loaddata now complains if fixture doesn't exist
If the fixture doesn't exist, loaddata will output a warning.

The fixture named "initial_data" is exceptional though; if it
doesn't exist, the warning is not emitted. This allows syncdb and
flush management commands to attempt to load it without causing
spurious warnings.

Thanks to Derega, ptone, dirigeant and d1ffuz0r for contributions
to the ticket.
2013-05-19 11:31:27 +02:00
Senko Rasic cc3b3ba93a Fixed #18990: Loaddata now complains if fixture doesn't exist
The fixture named "initial_data" is exceptional though; if it
doesn't exist, the error is not raised. This allows syncdb and
flush management commands to attempt to load it without causing
an error if it doesn't exist.
2013-05-19 10:56:09 +02:00
Loic Bistuer 6983a1a540 Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
Florian Apolloner 89f40e3624 Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00