Commit Graph

156 Commits

Author SHA1 Message Date
mlavin 4696cd9671 Fixed #22477 -- Removed contrib middleware from the global settings defaults.
Also added a compatibility check for changed middleware defaults.

Forwardport of d94de802d3 from stable/1.7.x
2014-06-13 12:45:56 -04:00
Preston Timmons 68efbfde5e Fixed #22068 -- Made runtests.py remove trailing slashes from test labels.
When using tab-completion it's easy to accidentally run a test with
a trailing slash, which causes INSTALLED_APPS to be set incorrectly.
Normalize the test labels to avoid this common error.

Thanks MattBlack for the suggestion.
2014-06-11 11:35:33 -04:00
Claude Paroz 96e4b52ab2 Converted Django scripts to argparse
Refs #19973.
2014-06-09 10:13:37 +02:00
Loic Bistuer 417ec4a68b Fixed a ResourceWarning that wasn't properly fixed by the previous commit.
Also removed unused import in runtests.py.
2014-05-26 04:01:41 +07:00
Claude Paroz f47e226ff7 Moved some imports in runtests.py 2014-05-24 13:29:23 +02:00
Claude Paroz 19b4908206 Made runtests.py use 'set_installed_apps' API
This will also trigger the ready method of any tested application,
which was not run before.
2014-05-24 11:02:58 +02:00
Marc Tamlyn 604162604b Added array field support for PostgreSQL.
The first part of django.contrib.postgres, including model and two form
fields for arrays of other data types.

This commit is formed of the following work:

    Add shell of postgres app and test handling.

    First draft of array fields.

    Use recursive deconstruction.

    Stop creating classes at lookup time.

    Add validation and size parameter.

    Add contained_by lookup.

    Add SimpleArrayField for forms.

    Add SplitArrayField (mainly for admin).

    Fix prepare_value for SimpleArrayField.

    Stop using MultiValueField and MultiWidget.

    They don't play nice with flexible sizes.

    Add basics of admin integration.

    Missing:
    - Tests
    - Fully working js

    Add reference document for django.contrib.postgres.fields.ArrayField.

    Various performance and style tweaks.

    Fix internal docs link, formalise code snippets.

    Remove the admin code for now.

    It needs a better way of handing JS widgets in the admin as a whole
    before it is easy to write. In particular there are serious issues
    involving DateTimePicker when used in an array.

    Add a test for nested array fields with different delimiters.

    This will be a documented pattern so having a test for it is useful.

    Add docs for SimpleArrayField.

    Add docs for SplitArrayField.

    Remove admin related code for now.

    definition -> description

    Fix typo.

    Py3 errors.

    Avoid using regexes where they're not needed.

    Allow passing tuples by the programmer.

    Add some more tests for multidimensional arrays.

    Also fix slicing as much as it can be fixed.

    Simplify SplitArrayWidget's data loading.

    If we aren't including the variable size one, we don't need to search
    like this.
2014-05-22 09:53:26 +01:00
Preston Timmons 251e833c75 Removed old test runner test cases.
These files were added as part of #12658, which pertained to the old django.test.simple test runner. No tests call them anymore.
2014-04-20 22:00:39 -05:00
Aymeric Augustin 232181d1c5 Advanced deprecation warnings for 1.8. 2014-03-22 21:12:58 +01:00
Tim Graham aa93a1890f Removed contrib.comments per deprecation timeline. 2014-03-21 07:05:36 -04:00
Claude Paroz 210d0489c5 Fixed #21188 -- Introduced subclasses for to-be-removed-in-django-XX warnings
Thanks Anssi Kääriäinen for the idea and Simon Charette for the
review.
2014-03-08 09:57:40 +01:00
Claude Paroz 4622d23ccf Fixed #22056 -- Omitted non-package directories when collecting tests
This allows us to ignore empty dirs or other unrelated dirs.
Thanks Sebastian Pawluś for the report and the initial patch.
2014-02-26 17:46:24 +01:00
Aymeric Augustin 4a488c1483 Silenced a spurious warning.
Thanks Timo for the report. Regression from 2f65b8e1. Refs #21794.
2014-02-01 19:42:41 +01:00
Aymeric Augustin 2ff93e027c Fixed #21829 -- Added default AppConfigs.
Thanks Russell for the report, Marc for the initial patch, Carl for the
final review, and everyone who contributed to the design discussion.
2014-01-25 10:41:56 +01:00
Aymeric Augustin 74d8fdcfa6 Stopped assuming that INSTALLED_APPS only contains app names.
While this assumption is true for the time being, it makes the code
needlessly brittle.
2014-01-18 23:06:00 +01:00
Aymeric Augustin 3326a412cc Deprecated importing a model before loading its application.
Refs #21719, #21680.
2014-01-10 23:43:10 +01:00
Claude Paroz b2d78939d1 Prevented calling setup() inside catch_warnings
When django.setup() (and then configure_logging) is called inside
catch_warnings, logging setup is negatively affected (notably
warnings.showwarning definition).
2014-01-01 22:59:12 +01:00
Aymeric Augustin 80d74097b4 Stopped populating the app registry as a side effect.
Since it triggers imports, it shouldn't be done lightly.

This commit adds a public API for doing it explicitly, django.setup(),
and does it automatically when using manage.py and wsgi.py.
2013-12-30 22:11:17 +01:00
Aymeric Augustin 38ce41103f Used Apps.clear_cache() in tests that alter the app registry. 2013-12-29 21:25:28 +01:00
Aymeric Augustin 8f04f53dd8 Removed a few gratuitous lambdas. 2013-12-26 14:03:50 +01:00
Aymeric Augustin 1716b7ce5a Renamed AppCache to Apps.
Also renamed app_cache to apps and "app cache" to "app registry".

Deprecated AppCache.app_cache_ready() in favor of Apps.ready().
2013-12-24 12:25:17 +01:00
Aymeric Augustin 82a35e24d4 Replaced ad-hoc caching of get_models with lru_cache.
Invalidate properly the cache whenever all_models or app_configs change.
This fixes some isolation issues in the test suite.
2013-12-24 10:56:50 +01:00
Aymeric Augustin da16bb30ff Dropped AppCache._empty, _with_app and _without_app.
It's now easier to achieve the same effect with modify_settings or
override_settings.
2013-12-23 21:37:56 +01:00
Aymeric Augustin 2fef9e5375 Moved apps back in the toplevel django namespace.
Reverted 4a56a93cc4.
2013-12-22 11:39:55 +01:00
Aymeric Augustin f25fa9d859 Deprecated load_app().
Adjusted several tests that used it to add apps to the app cache and
then attempted to remove them by manipulating attributes directly.

Also renamed invalid_models to invalid_models_tests to avoid clashing
application labels between the outer and the inner invalid_models
applications.
2013-12-22 11:39:17 +01:00
Aymeric Augustin 86804ab063 Terminated AppCache._populate() with extreme prejudice.
It was called _populate() before I renamed it to populate(). Since it
has been superseded by populate_models() there's no reason to keep it.

Removed the can_postpone argument of load_app() as it was only used by
populate(). It's a private API and there's no replacement. Simplified
load_app() accordingly. Then new version behaves exactly like the old
one even though it's much shorter.
2013-12-22 11:39:17 +01:00
Aymeric Augustin 6e895f9e06 Removed superfluous models.py files.
Added comments in the three empty models.py files that are still needed.

Adjusted the test runner to add applications corresponding to test
labels to INSTALLED_APPS even when they don't have a models module.
2013-12-17 11:16:48 +01:00
Aymeric Augustin 4a56a93cc4 Moved the new app cache inside core. 2013-12-17 10:17:46 +01:00
Aymeric Augustin 2732edc5f2 Deprecated get_apps(). 2013-12-17 10:17:45 +01:00
Aymeric Augustin d44de9b933 Removed the _-prefix for populate().
Several parts of Django call get_apps() with a comment along this lines
of "this has the side effect of calling _populate()". I fail to see how
this is better than just calling populate()!
2013-12-17 10:17:45 +01:00
Aymeric Augustin 8662654d6d Removed module-level functions for the app cache.
Since the original ones in django.db.models.loading were kept only for
backwards compatibility, there's no need to recreate them. However, many
internals of Django still relied on them.

They were also imported in django.db.models. They never appear in the
documentation, except a quick mention of get_models and get_app in the
1.2 release notes to document an edge case in GIS. I don't think that
makes them a public API.

This commit doesn't change the overall amount of global state but
clarifies that it's tied to the app_cache object instead of hiding it
behind half a dozen functions.
2013-12-17 10:17:44 +01:00
Aymeric Augustin 860c2c8bc5 Moved django.db.models.loading to django.apps.cache.
This commit doesn't contain any code changes; it's purely a refactoring.
2013-12-17 10:17:43 +01:00
Christopher Medrela 7477a4ffde Fixed E125 pep8 warnings 2013-11-28 08:50:11 -05:00
Tim Graham c573d6de17 Fixed #19941 -- Removed sys.path hack when running the test suite.
Thanks jezdez for the suggestion.
2013-10-23 18:27:06 -04:00
Alasdair Nicol a800036981 Fixed #21287 -- Fixed E123 pep8 warnings 2013-10-18 10:07:39 +01:00
Kevin Christopher Henry 978e1351a6 Fixed #21122 -- Improved clean up of test temp directory on Windows
- Fixed test that didn't close the files it opened
- Caught and handled exception when temp directory cannot be removed
2013-10-02 09:12:58 -04:00
Simon Charette ab643cd634 Fixed test suite bisection on Python 3.
Thanks to @marfire for spotting this.
2013-09-23 17:05:36 -04:00
Tim Graham 86964a7b4f Silenced deprecation warning regarding old SQL location; refs #14300 2013-09-03 11:10:43 -04:00
Ramiro Morales 72712755c4 Ignore coverage HTML report output dir in tests.
Added it to the list of dirs ignored by tests/runtests.py.
2013-08-25 19:09:03 -03:00
Ramiro Morales deebb1a977 Import test case classes from their public API module. 2013-08-20 22:23:41 -03:00
Ramiro Morales 22af1394c6 Expand testing of Test LiveServerTestCase static files serving. 2013-08-10 16:32:07 -03:00
Anssi Kääriäinen b2314d9e1e Fixed #19941 -- Modified runtests.py to make running the tests easier.
1. Automatically use tests/../django as the Django version.
2. If settings aren't provided through --settings or DJANGO_SETTINGS_MODULE)
   then use test_sqlite.
2013-07-24 07:33:03 -04:00
Tim Graham 4d92a0bd86 Fixed #19196 -- Added test/requirements 2013-07-10 09:24:05 -04:00
Claude Paroz 57f190ed3b Only import gis test apps for geo-enabled DBs 2013-07-09 15:58:56 +02:00
Claude Paroz bd563f0f57 Trusted test skipping about gis tests running or not
With the new test discovery system, gis tests are discovered as
other tests. They should be properly skipped now when dependencies
are missing. So let's stop special casing their inclusion.
2013-07-09 15:17:26 +02:00
Aymeric Augustin acd7b34aaf Advanced deprecation warnings for Django 1.7. 2013-06-29 18:49:37 +02:00
Marc Tamlyn 46789e76c6 Fixed #20548 -- Removed all PendingDeprecationWarnings from django test suite 2013-06-14 15:37:39 +01:00
Florian Apolloner af70dfcf31 Reverted the introduction of shared_models.
The recent improvements should make shared_models obsolete.

This reverts commit 1059da8de6, reversing
changes made to 4fa7f3cdd9.
2013-06-10 12:34:47 +02:00
Aymeric Augustin c6e6d4eeb7 Defined available_apps in relevant tests.
Fixed #20483.
2013-06-10 11:30:01 +02:00
Florian Apolloner e23a5f9a47 Fixed a regression in the test runner loading of runtests.py.
Refs #17365, #17366, #18727.
2013-05-11 15:47:40 +02:00