summaryrefslogtreecommitdiff
path: root/django/test
AgeCommit message (Collapse)Author
2013-12-20Set stacklevel for the override_settings warning.Aymeric Augustin
Refs #19031.
2013-12-17Moved the new app cache inside core.Aymeric Augustin
2013-12-17Refactored old test runner to handle apps without a models module.Aymeric Augustin
2013-12-17Deprecated get_app().Aymeric Augustin
2013-12-17Deprecated get_apps().Aymeric Augustin
2013-12-17Removed module-level functions for the app cache.Aymeric Augustin
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-17Moved django.db.models.loading to django.apps.cache.Aymeric Augustin
This commit doesn't contain any code changes; it's purely a refactoring.
2013-12-14Fixed E127 pep8 warnings.Loic Bistuer
2013-12-11Fixed #21462 -- Made `assertNumQueries` print executed queries on failure.Dominic Rodger
2013-12-10Fixed E124 pep8 warnings.Loic Bistuer
2013-11-28Fixed E125 pep8 warningsChristopher Medrela
2013-11-26Fixed #21448 -- Fixed test client logout with cookie-based sessionsClaude Paroz
Thanks Gunnar Scherf for the report and the suggested patch.
2013-11-25Fixed #21509 -- Removed dead exception catching code.Krzysztof Jurewicz
Since Python 2.5, KeyboardInterrupt and SystemExit are not subclasses of Exception, so explicitly reraising them before the “except Exception” clause is not necessary anymore.
2013-11-23Fixed #21012 -- New API to access cache backends.Curtis Maloney
Thanks Curtis Malony and Florian Apolloner. Squashed commit of the following: commit 3380495e93f5e81b80a251b03ddb0a80b17685f5 Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sat Nov 23 14:18:07 2013 +0100 Looked up the template_fragments cache at runtime. commit 905a74f52b24a198f802520ff06290a94dedc687 Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sat Nov 23 14:19:48 2013 +0100 Removed all uses of create_cache. Refactored the cache tests significantly. Made it safe to override the CACHES setting. commit 35e289fe9285feffed3c60657af9279a6a2cfccc Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sat Nov 23 12:23:57 2013 +0100 Removed create_cache function. commit 8e274f747a1f1c0c0e6c37873e29067f7fa022e8 Author: Aymeric Augustin <aymeric.augustin@m4x.org> Date: Sat Nov 23 12:04:52 2013 +0100 Updated docs to describe a simplified cache backend API. commit ee7eb0f73e6d4699edcf5d357dce715224525cf6 Author: Curtis Maloney <curtis@tinbrain.net> Date: Sat Oct 19 09:49:24 2013 +1100 Fixed #21012 -- Thread-local caches, like databases.
2013-11-19Fixed #15179 -- middlewares not applied for test client login()Unai Zalakain
Requests made with django.test.Client.login() and logout() respect defaults defined in django.test.Client instantiation and are processed through middleware. Thanks to Loic for the reviews.
2013-11-11Fixed #21351 -- Replaced memoize with Python's lru_cache.Bouke Haarsma
Replaced the custom, untested memoize with a similar decorator from Python's 3.2 stdlib. Although some minor performance degradation (see ticket), it is expected that in the long run lru_cache will outperform memoize once it is implemented in C. Thanks to EvilDMP for the report and Baptiste Mispelon for the idea of replacing memoize with lru_cache.
2013-11-09Fixed #21383 -- Added request details in SuspiciousOperation messagesClaude Paroz
2013-11-09Removed useless comment. Refs #21172Anssi Kääriäinen
2013-11-09Merge pull request #1743 from unaizalakain/ticket_21172Anssi Kääriäinen
Fixed #21172 -- have LiveServerThread follow the semantics of threading.Thread.join()
2013-11-08Fixed #17529 -- get_template_from_string default arguments breakUnai Zalakain
``get_template_from_string`` default arguments were breaking ``assertTemplateUsed``. The solution has been to return only the names of the templates with a ``name`` attribute distinct of ``None``. The default ``name`` kwarg of ``Template`` has been changed to ``None``, more pythonic than ``'<Unknown Template>'``.
2013-11-07Merge pull request #1850 from unaizalakain/ticket_13725Anssi Kääriäinen
Fixed #13725 -- take url scheme into account in assertRedirects Thanks to Loic for review.
2013-11-07Fixed #13725 -- take url scheme into account in assertRedirectsUnai Zalakain
Scheme is handled correctly when making comparisons between two URLs. If there isn't any scheme specified in the location where we are redirected to, the original request's scheme is used. If present, the scheme in ``expected_url`` is the one used to make the comparations to.
2013-11-04Merge pull request #1821 from Bouke/tickets/14170Aymeric Augustin
#14170 -- Reset i18n cache when settings changed
2013-11-04Fixed ticket #21172Unai Zalakain
LiveServerThread.join() now behaves like threading.Thread.join(). LiveServerThread.terminate() is instead used to ask live http server to terminate and close.
2013-11-03Fixed all E226 violationsAlex Gaynor
2013-11-03Fixed #14170 -- Reset i18n cache when settings changeBouke Haarsma
2013-11-02Checkout prior commit of _doctest.pyRay Ashman Jr
2013-11-02Revert change to django/test/_doctest.pyRay Ashman Jr
2013-11-02Correct flake8 E302 violationsRay Ashman Jr
2013-11-02Fixed all E261 warningscoagulant
2013-11-02Fixed flake8 E241Boryslav Larin
2013-11-02Fixed #21302 -- Fixed unused imports and import *.Tim Graham
2013-11-02Fixed #21341 -- Eased https requests with the test clientUnai Zalakain
All request methods of ``django.test.client.Client`` receive a ``secure`` argument that defaults to ``False`` indicating whether or not to make the request through https. Thanks Aymeric Augustin for the review.
2013-10-26Fixed all the E203 violationsAlex Gaynor
2013-10-26Fixed up some more flake8 violations (this particular violation still has ↵Alex Gaynor
many occurrences in the tests/ dir so it can't be removed from setup.cfg yet)
2013-10-23Fixed #21298 -- Fixed E301 pep8 warningsAlasdair Nicol
2013-10-22Fixed #21307 -- Moved TransRealMixin to django.test.utils.Ramiro Morales
2013-10-21Fixed #21288 -- Fixed E126 pep8 warningsAlasdair Nicol
2013-10-18Fixed #21287 -- Fixed E123 pep8 warningsAlasdair Nicol
2013-10-18Fixed #21268 -- Fixed E303 pep8 warningsAlasdair Nicol
2013-10-17Fixed #21285 -- Fixed E121,E122 pep8 warningsAlasdair Nicol
2013-10-15Fixed #21263 -- Fixed issue with override_settings in inherited classesClaude Paroz
When both parent and child classes are decorated with override_settings, child class settings should take precedence. Thanks Sephi for the report and Marc Tamlyn for the review.
2013-10-14Fixed #21266 -- Fixed E201,E202 pep8 warnings.Larry O'Neill
2013-10-10Used "is" for comparisons with None.Tim Graham
2013-10-01Factorized requires_tz_support decorator in test utilsClaude Paroz
Thanks Aymeric Augustin for the suggestion. Refs #21165.
2013-09-28Fixed #21162 -- Better emulation of staticfiles middleware.Ramiro Morales
Code had been added in e909ceae9b. Solves test suite failures observed on Windows. Thanks Michael Manfre for the report. Refs #20739.
2013-09-22Fixed "Address already in use" from liveserver.Florian Apolloner
Our WSGIServer rewrapped the socket errors from server_bind into WSGIServerExceptions, which is used later on to provide nicer error messages in runserver and used by the liveserver to see if the port is already in use. But wrapping server_bind isn't enough since it only binds to the socket, socket.listen (which is called from server_activate) could also raise "Address already in use". Instead of overriding server_activate too I chose to just catch socket errors, which seems to make more sense anyways and should be more robust against changes in wsgiref.
2013-09-22Removed a few trailing backslashes.Aymeric Augustin
We have always been at war with trailing backslashes.
2013-09-17Final attempt to solve sporadic test failures.Florian Apolloner
tearDownClass is not called if setUpClass throws an exception, in our case this means that LiveServerTestCase leaks LiveServerThread sockets if the test happens to be skipped later on, and AdminSeleniumWebDriverTestCase doesn't close it's already open browser window. To prevent this leakage we catch errors where needed and manually call _tearDownClassInternal. _tearDownClassInternal should be written as defensively as possible since it is not allowed to make any assumptions on how far setUpClass got. This patch should fix the sporadic "Address already in use"-errors on jenkins and also the "This code isn't under transaction management"-error for sqlite (also just on jenkins). After discussion with koniiiik, jezdez, kmtracey, tos9, lifeless, nedbat and voidspace it was decided that this is the safest approach (thanks to everyone for their comments and help). Manually calling tearDownClass was shut down cause we don't know how our users override our classes. This is a private and very specialized API on purpose and should not be used without a strong reason! This patch partially reverts the earlier attempts to fix those issues, namely: 2fa0dd73b18f55d0fdd1c1d54b1d18031bfcf1ed and 3c5775d36f7e431d9691829a78580873111cb714 Final note: If this patch breaks in a later version of Django, please be very careful on how you fix it, you might not see test failures locally. That said, this patch hopefully doesn't produce even more failures.
2013-09-14REmoved some unused importsAlex Gaynor