Commit Graph

300 Commits

Author SHA1 Message Date
Mariusz Felisiak faba5b702a
Refs #32355 -- Used addClassCleanup() in SimpleTestCase and SerializeMixin. 2021-06-08 11:35:05 +02:00
Adam Johnson 2e4711c611 Made SerializeMixin check lockfile attr at import time. 2021-06-04 12:29:09 +02:00
Chris Jerdonek 823a9e6bac Fixed #32416 -- Made ThreadedWSGIServer close connections after each thread.
ThreadedWSGIServer is used by LiveServerTestCase.
2021-04-12 10:23:56 +02:00
Chris Jerdonek 71a936f9d8 Refs #32416 -- Added LiveServerTestCase._make_connections_override() hook. 2021-04-12 08:54:03 +02:00
Claude Paroz bc43ae7c13
Refs #31235 -- Improved assertQuerysetEqual() warning message with stacklevel=2. 2021-03-10 16:09:05 +01:00
Jacob Walls 7d68fa4ed3
Fixed typo assertNotContains() docstring. 2021-03-04 20:54:06 +01:00
François Freitag 7ca7f4495b Refs #21429 -- Added SimpleTestCase.assertNoLogs() on Python < 3.10. 2021-03-02 20:35:33 +01:00
Jacob Walls 64a0d1ef6e Fixed typo in assertQuerysetEqual() exception message. 2021-02-26 21:12:11 +01:00
Nick Pope 0e4e35722a Fixed #32469 -- Made assertQuerysetEqual() respect maxDiff when ordered=False. 2021-02-22 09:27:46 +01:00
Chris Jerdonek 600ff26a85 Fixed #32417 -- Removed unneeded hasattr() check in LiveServerTestCase._tearDownClassInternal(). 2021-02-15 10:25:11 +01:00
Chris Jerdonek 694deff82f Fixed #32437 -- Fixed cleaning up ALLOWED_HOSTS in LiveServerTestCase on setUpClass() failure. 2021-02-12 09:39:48 +01:00
Chris Jerdonek 91c243f80f Refs #32416 -- Added LiveServerThread.server_class to ease subclassing. 2021-02-12 08:17:46 +01:00
Ian Foote 3828879eee Fixed #32220 -- Added durable argument to transaction.atomic(). 2020-11-27 21:43:15 +01:00
Hasan Ramezani 3f7b327562 Fixed #31235 -- Made assertQuerysetEqual() compare querysets directly.
This also replaces assertQuerysetEqual() to
assertSequenceEqual()/assertCountEqual() where appropriate.

Co-authored-by: Peter Inglesby <peter.inglesby@gmail.com>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-11-06 09:24:50 +01:00
Mads Jensen 3718bc5c8d Removed unnecessary urlsplit() call from SimpleTestCase.assertRedirects(). 2020-08-14 11:48:04 +02:00
Adam Johnson e906ff6fca Fixed #30457 -- Added TestCase.captureOnCommitCallbacks(). 2020-07-13 11:56:46 +02:00
Simon Charette 3cf80d3fcf Fixed #31395 -- Made setUpTestData enforce in-memory data isolation.
Since it's introduction in Django 1.8 setUpTestData has been suffering
from a documented but confusing caveat due to its sharing of attributes
assigned during its execution with all test instances.

By keeping track of class attributes assigned during the setUpTestData
phase its possible to ensure only deep copies are provided to test
instances on attribute retreival and prevent manual setUp gymnastic to
work around the previous lack of in-memory data isolation.

Thanks Adam Johnson for the extensive review.
2020-05-15 20:22:52 +02:00
Andrew Godwin fc0fa72ff4 Fixed #31224 -- Added support for asynchronous views and middleware.
This implements support for asynchronous views, asynchronous tests,
asynchronous middleware, and an asynchronous test client.
2020-03-18 19:59:12 +01:00
Andrew Godwin 17009e9105 Refs #31224 -- Added autoconversion of test async methods. 2020-03-05 14:29:21 +01:00
André Ericson 3120490912 Fixed #30876 -- Moved classproperty() decorator to the django.utils.functional. 2019-10-21 09:57:39 +02:00
Pavel Savchenko 1711c509fa Fixed #27391 -- Implemented SimpleTestCase.debug().
debug() should bubbled up exceptions if occurring in test, but behave
the same as run() when no exceptions occurred.
2019-10-18 12:22:51 +02:00
Patrick Jenkins 46e74a5256 Fixed #28337 -- Preserved extra headers of requests made with django.test.Client in assertRedirects().
Co-Authored-By: Hasan Ramezani <hasan.r67@gmail.com>
2019-10-18 08:42:51 +02:00
Mariusz Felisiak b61ea56789 Refs #28478 -- Removed support for TestCase's allow_database_queries and multi_db per deprecation timeline. 2019-09-10 12:01:00 +02:00
Jon Dufresne 76990cbbda Fixed #30171 -- Fixed DatabaseError in servers tests.
Made DatabaseWrapper thread sharing logic reentrant. Used a reference
counting like scheme to allow nested uses.

The error appeared after 8c775391b7.
2019-02-14 10:04:55 -05:00
Jon Dufresne d15c61cabb Fixed #30121 -- Fixed assertURLEqual() crash with reverse_lazy() URLs.
Regression in 24959e48d9.
2019-01-21 09:31:33 -05:00
Simon Charette b181aba7dd Refs #28478 -- Prevented database feature based skipping on tests disallowing queries.
Database features may require a connection to be established to determine
whether or not they are enabled.
2019-01-14 16:16:30 -05:00
Simon Charette f5b635086a Refs #28478 -- Prevented connection attempts against disallowed databases in tests.
Mocking connect as well as cursor methods makes sure an appropriate error
message is surfaced when running a subset of test attempting to access a
a disallowed database.
2019-01-14 16:05:00 -05:00
Simon Charette 8c775391b7 Refs #28478 -- Deprecated TestCase's allow_database_queries and multi_db in favor of databases. 2019-01-10 19:11:21 -05:00
Tim Graham 4c7c608a1d Reverted "Fixed #25251 -- Made data migrations available in TransactionTestCase when using --keepdb."
This reverts commits b3b1d3d45f and
9fa0d3786f due to reverse build failures
for which a solution isn't forthcoming.
2018-12-05 15:30:23 -05:00
romgar b3b1d3d45f Fixed #25251 -- Made data migrations available in TransactionTestCase when using --keepdb.
Data loaded in migrations were restored at the beginning of each
TransactionTestCase and all the tables are truncated at the end of
these test cases. If there was a TransactionTestCase at the end of
the test suite, the migrated data weren't restored in the database
(especially unexpected when using --keepdb). Now data is restored
at the end of each TransactionTestCase.
2018-11-06 16:57:50 -05:00
Tom Forbes d207ac1568 Fixed #29883 -- Added selenium hub support to runtests.py. 2018-11-03 09:56:14 -04:00
Sergey Fedoseev 8ef8bc0f64 Refs #28909 -- Simplifed code using unpacking generalizations. 2018-09-28 09:57:12 -04:00
Mariusz Felisiak a73cf8110e Removed duplicate words in various comments. 2018-07-18 11:54:15 -04:00
Jan Pieter Waagmeester 24959e48d9 Fixed #27398 -- Added an assertion to compare URLs, ignoring the order of their query strings. 2018-06-20 13:26:12 -04:00
Morgan Aubert 704443acac Fixed #29363 -- Added SimpleTestCase.assertWarnsMessage(). 2018-05-09 11:40:28 -04:00
Chris Lamb 84ad721bd9 Fixed #29275 -- Made assertFormError() output "(actual errors: none)" instead of "(actual errors: )". 2018-03-31 18:35:45 -04:00
Jon Dufresne 919d59811f Refs #27795 -- Removed force_text() usage in django/test/testcases.py. 2018-02-10 11:44:39 -05:00
Nick Pope f3a98224e6 Refs #28909 -- Simplifed code using unpacking generalizations. 2017-12-21 21:05:23 -05:00
Nick Pope d13a9e44de Fixed #28909 -- Simplified code using tuple/list/set/dict unpacking. 2017-12-11 07:08:45 -05:00
Дилян Палаузов d2afa5eb23 Fixed #28860 -- Removed unnecessary len() calls. 2017-12-04 10:35:23 -05:00
Jon Dufresne 7a6fbf36b1 Fixed #28853 -- Updated connection.cursor() uses to use a context manager. 2017-11-28 11:28:09 -05:00
Tim Graham 98706bb35e Refs #27857 -- Replaced json.loads() ValueError exception catching with JSONDecodeError. 2017-09-25 17:11:06 -04:00
Luoxzhg ffbee67f8e Fixed some comments referring to a nonexistent TestClient class. 2017-09-09 11:21:15 -04:00
François Freitag e36598f963 Refs #27539 -- Fixed typo in TransactionTestCase._pre_setup() comment. 2017-06-18 21:24:20 -04:00
reficul31 92e286498a Fixed #27539 -- Made TransactionTestCase._pre_setup() clear the queries_log so it's less likely to overflow.
TransactionTestCase.assertNumQueries() fails in an overflow situation.
2017-06-16 21:06:13 -04:00
Chandrakant Kumar f6800a081a Refs #27787 -- Corrected or removed invalid call_command() options. 2017-06-16 11:06:01 -04:00
Robert Rollins b6d4b6e544 Fixed #28212 -- Allowed customizing the port that LiveServerTestCase uses.
Forwardport of 877d7b71ae from stable/1.11.x
2017-05-30 18:49:10 -04:00
Claude Paroz 43c65e0eb0 Fixed #28180 -- Numbered queries in assertNumQueries failure output
Thanks Tim Graham for the test part.
2017-05-20 15:11:09 +02:00
Anton Samarchyan 86de930f41 Refs #27656 -- Updated remaining docstring verbs according to PEP 257. 2017-03-04 10:02:06 -05:00
Tim Graham 3f5a35d6e2 Added TransactionTestCase.multi_db instead of using getattr(). 2017-02-13 08:46:00 -05:00