Commit Graph

139 Commits

Author SHA1 Message Date
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
Carl Meyer 9012833af8 Fixed #17365, #17366, #18727 -- Switched to discovery test runner.
Thanks to Preston Timmons for the bulk of the work on the patch, especially
updating Django's own test suite to comply with the requirements of the new
runner. Thanks also to Jannis Leidel and Mahdi Yusuf for earlier work on the
patch and the discovery runner.

Refs #11077, #17032, and #18670.
2013-05-10 23:08:45 -04:00
Preston Holmes e79b857a07 Fixed #18985 -- ensure module level deprecations are displayed
Also don't compete with -W CLI option.

Thanks to Aymeric Augustin for the catch, and Claude Paroz for the patch.
2013-03-24 22:06:02 -07:00
Jacob Kaplan-Moss 1059da8de6 Merge pull request #900 from bmispelon/ticket-20022
Fix #20022: Correctly handle prefixes with url-unsafe characters in reverse()
2013-03-13 22:39:25 +01:00
Jacob Kaplan-Moss d056124269 Remove a special case for comment tests from runtests.py. 2013-03-11 15:38:53 -05:00
Claude Paroz 9b74a8391d Removed forced settings in runtests
Tests that require USE_I18N, LOGIN_URL or certain MIDDLEWARE_CLASSES
should be decorated appropriately.
2013-03-11 17:46:56 +01:00
Florian Apolloner 0dc7ff6b7a Ensured that we have an absolute path to RUNTESTS_DIR.
This is needed to make 'python runtests.py' work, otherwise only
'python ./runtests.py' would work.
2013-02-26 15:20:37 +01:00
Florian Apolloner 33836cf88d Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
Florian Apolloner fc074db29c Adjusted runtests to the new layout. 2013-02-26 14:36:57 +01:00
Florian Apolloner 41d7a9a907 Moved test_templates to templates to prevent issues with regressiontests/templates later on. 2013-02-26 14:36:57 +01:00
Carl Meyer 906dc8522a Fixed #19854 -- Turn Django's own Selenium tests off by default. 2013-02-25 10:14:42 -07:00
Florian Apolloner e4ee3d8fca Fixed a few ResourceWarnings. 2013-02-24 13:11:19 +01:00
Zbigniew Siciarz 1cd2f51eb4 Added test runner option to skip Selenium tests (#19854). 2013-02-23 17:45:26 +01:00
Aymeric Augustin 052271168b Removed django.contrib.databrowse.
RIP -- you served us well.
2012-12-29 21:58:12 +01:00
Claude Paroz c91667338a Fixed #19357 -- Allow non-ASCII chars in filesystem paths
Thanks kujiu for the report and Aymeric Augustin for the review.
2012-12-08 11:13:52 +01:00
Alex Gaynor 4285571c5a Fixed #5805 -- it is now possible to specify multi-column indexes. Thanks to jgelens for the original patch. 2012-11-04 10:16:06 -08:00
Carl Meyer a78dd109e6 Fixed #15552 -- LOGIN_URL and LOGIN_REDIRECT_URL can take URLpattern names.
Thanks UloPe and Eric Florenzano for the patch, and Malcolm Tredinnick for
review.
2012-09-08 16:58:35 -06:00
Aymeric Augustin bdca5ea345 [py3] Replaced unicode/str by six.text_type/bytes. 2012-07-22 09:29:54 +02:00