Commit Graph

820 Commits

Author SHA1 Message Date
Johannes Hoppe 8d010f3986 Fixed #30220 -- Added support for headless mode in selenium tests. 2019-05-17 08:14:54 +02:00
Jon Dufresne 7c3732a1b4 Fixed #30470 -- Added assertHTMLEqual() support for all self closing tags.
Support for the following tags was added: area, embed, param, track, and
wbr.

The full list of self closing tags is documented at:

https://html.spec.whatwg.org/#void-elements
2019-05-10 12:04:07 +02:00
Jon Dufresne b7a33ee4f0 Fixed #30468 -- Fixed assertHTMLEqual() to handle all ASCII whitespace in a class attribute. 2019-05-09 17:18:18 +02:00
Jon Dufresne 48235ba807 Refs #30399 -- Made assertHTMLEqual normalize character and entity references. 2019-05-09 15:55:32 +02:00
François Freitag 568eed9e79 Fixed #30245 -- Added -k option to DiscoverRunner. 2019-04-30 16:20:51 +02:00
Jon Dufresne 8b3f1c35dd Removed unnecessary assignments in various code. 2019-04-24 13:09:29 +02:00
Ramiro Morales aed89adad5 Fixed #30367 -- Changed "pip install" to "python -m pip install" in docs, comments and hints. 2019-04-18 14:41:15 +02:00
Jon Dufresne 45dfb3641a Minimized try block in Client.request(). 2019-03-11 10:39:59 -04:00
Jon Dufresne ff09add274 Refs #18807 -- Removed unused exception handler from Client.request().
Unused since 8bd7b598b6.
2019-03-10 18:10:51 -07:00
Jon Dufresne 7feddd878c Fixed #18707 -- Added support for the test client to return 500 responses. 2019-02-20 12:16:10 +01: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
Sergey Fedoseev 1933e56eca Removed uneeded generator expressions and list comprehensions. 2019-02-09 09:18:48 -05:00
Nick Pope 24b82cd201 Fixed #30159 -- Removed unneeded use of OrderedDict.
Dicts preserve order since Python 3.6.
2019-02-06 13:48:39 -05:00
Tim Graham 6d2ae49f25 Refs #27753 -- Removed django.test.utils.patch_logger() and str_prefix(). 2019-02-05 12:52:07 -05:00
Jon Dufresne ac956dae1d Fixed grammar in FakePayload exception message. 2019-01-25 08:43:21 -08:00
Jon Dufresne d15c61cabb Fixed #30121 -- Fixed assertURLEqual() crash with reverse_lazy() URLs.
Regression in 24959e48d9.
2019-01-21 09:31:33 -05:00
Jon Dufresne ad7aa02c1d Removed unnecessary string formatting of strings. 2019-01-14 21:04:00 -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 41e73de39d Fixed #28478 -- Make DiscoverRunner skip creating unused test databases.
SimpleTestCase.databases makes it possible to determine the set of
databases required to run the discovered tests.
2019-01-10 19:11:21 -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
Jon Dufresne 6fe9c45b72 Fixed #30024 -- Made urlencode() and Client raise TypeError when None is passed as data. 2018-12-27 11:19:55 -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 9fa0d3786f Refs #25251 -- Filtered out skipped tests when processing the test suite to set _next_serialized_rollback. 2018-11-29 11:20:27 -05:00
takaaki shimbo 6275b50ac2 Fixed typo in patch_logger() docstring. 2018-11-25 14:43:26 -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
Tim Graham 1c948e544e Refs #29883 -- Removed runtests.py's dependency on selenium.
Regression in d207ac1568.
2018-11-03 19:02:31 -04:00
Tom Forbes d207ac1568 Fixed #29883 -- Added selenium hub support to runtests.py. 2018-11-03 09:56:14 -04:00
Jayden Kneller 916aecd29d Fixed #29866 -- Made DiscoverRunner do tests tear down if running checks or tests raises an exception. 2018-10-30 12:01:48 -04:00
Jon Dufresne e90af8bad4 Capitalized "Python" in docs and comments. 2018-10-09 09:26:07 -04:00
Sergey Fedoseev 8ef8bc0f64 Refs #28909 -- Simplifed code using unpacking generalizations. 2018-09-28 09:57:12 -04:00
Jon Dufresne 82f286cf6f Refs #29784 -- Switched to https:// links where available. 2018-09-26 08:48:47 +02:00
Dan Palmer e181666973 Fixed #29687 -- Allowed the test client to serialize list/tuple as JSON. 2018-08-25 10:57:05 -04:00
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) 233c70f047 Fixed #29658 -- Registered model lookups in tests with a context manager. 2018-08-21 12:17:46 -04:00
Kamil 3d4080f19c Fixed #29024 -- Made TestContextDecorator call disable() if setUp() raises an exception. 2018-08-17 16:30:27 -04:00
Marnanel Thurman 7cc52250f0 Fixed #29662 -- Allowed test client to accept structured suffix JSON content types. 2018-08-15 10:27:45 -04:00
Sławek Ehlert c6238bf02b Fixed #29467 -- Made override_settings handle errors in setting_changed signal receivers. 2018-07-30 15:59:37 -04:00
Thng Kai Yuan 71a739f3d7 Fixed #29576 -- Corrected the test client's HTTP_COOKIE header. 2018-07-21 18:14:39 -04:00
Mariusz Felisiak a73cf8110e Removed duplicate words in various comments. 2018-07-18 11:54:15 -04:00
Tim Graham 5bea8d256d
Fixed #29553 -- Made test client set Content-Length header to a string rather than integer. 2018-07-09 11:44:49 -04:00
Claude Paroz eac9ab7ebb Removed parser.add_arguments() arguments that match the defaults. 2018-07-02 17:54:57 -04:00
Tim Graham 9294110a57 Fixed #29520 -- Fixed test client crash when posting bytes.
Regression in b8a41a2872.
2018-06-27 14:50:03 -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
Jon Dufresne 8dcd43ce06 Restored django.test.utils.patch_logger() for backwards compatibility.
Added back after 607970f31c.
2018-06-12 11:33:16 -04:00
Morgan Aubert 704443acac Fixed #29363 -- Added SimpleTestCase.assertWarnsMessage(). 2018-05-09 11:40:28 -04:00
Claude Paroz 607970f31c Replaced django.test.utils.patch_logger() with assertLogs().
Thanks Tim Graham for the review.
2018-05-07 09:34:00 -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
Mariusz Felisiak 362813d628
Fixed hanging indentation in various code. 2018-03-16 10:54:34 +01:00
Sanyam Khurana 5a669ae2f4 Fixed #29106 -- Made DiscoverRunner display selected test tags. 2018-02-13 12:56:31 -05:00
Tim Graham b8a41a2872 Refs #27795 -- Removed force_bytes() in django.test.client where possible. 2018-02-12 11:03:11 -05:00
Jon Dufresne 919d59811f Refs #27795 -- Removed force_text() usage in django/test/testcases.py. 2018-02-10 11:44:39 -05:00
Nick Sarbicki 47268242b0 Fixed #29082 -- Allowed the test client to encode JSON request data. 2018-02-06 18:29:04 -05:00
Tom 272f685794 Fixed #27999 -- Added test client support for HTTP 307 and 308 redirects. 2018-02-06 09:03:43 -05:00
Jon Dufresne ff05de760c Fixed #29038 -- Removed closing slash from HTML void tags. 2018-01-21 02:09:10 -05:00
Will Ayd 09530e61a0 Fixed #28869 -- Made tagged test classes and methods inherit tags from parents. 2018-01-08 20:57:33 -05:00
Дилян Палаузов d7b2aa24f7 Fixed #28982 -- Simplified code with and/or. 2018-01-03 20:12:23 -05:00
Tim Graham acc8dd4142
Fixed #28984 -- Made assorted code simplifications. 2018-01-03 13:24:02 -05:00
Дилян Палаузов d79cf1e9e2 Fixed #28985 -- Removed unneeded None checks before hasattr(). 2018-01-03 11:37:06 -05:00
Дилян Палаузов 4c599ece57 Fixed #28930 -- Simplified code with any() and all(). 2017-12-26 17:11:15 -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
Nick Pope c68f66e014 Refs #23919 -- Replaced super() calls for old-style classes. 2017-12-07 09:10:32 -05:00
Tim Graham a862af3839
Fixed #28893 -- Removed unnecessary dict.items() calls. 2017-12-06 17:17:59 -05:00
Дилян Палаузов d2afa5eb23 Fixed #28860 -- Removed unnecessary len() calls. 2017-12-04 10:35:23 -05:00
Nicolas Delaby 746caf3ef8 Fixed #28837 -- Fixed test client crash if an exception with more than one arg is raised.
Also removed usage of the problematic pattern elsewhere.

Regression in 6e55e1d88a.
2017-11-28 18:55: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
Rachel Tobin 6c92f711ea Refs #28575 -- Allowed pickling Model.DoesNotExist and MultipleObjectsReturned classes. 2017-10-13 09:16:09 -04:00
Tim Graham 98706bb35e Refs #27857 -- Replaced json.loads() ValueError exception catching with JSONDecodeError. 2017-09-25 17:11:06 -04:00
Tim Graham cfff2af02b Fixed #27857 -- Dropped support for Python 3.4. 2017-09-25 17:11:03 -04:00
Tim Graham 9463a7a8cd Refs #26840 -- Removed django.test.runner.setup_databases() per deprecation timeline. 2017-09-22 12:51:17 -04:00
Jon Dufresne 99e65d6488 Fixed #28578 -- Renamed DatabaseCreation number arguments to suffix. 2017-09-11 11:32:40 -04:00
Luoxzhg ffbee67f8e Fixed some comments referring to a nonexistent TestClient class. 2017-09-09 11:21:15 -04:00
Tim Graham 6e4c6281db Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()."
This reverts commit 550cb3a365
because try/except performs better.
2017-09-07 08:16:21 -04:00
Sergey Fedoseev 5b1c389603 Refs #23919 -- Replaced usage of django.utils.functional.curry() with functools.partial()/partialmethod(). 2017-09-06 13:11:18 -04:00
Sergey Fedoseev 481ba33cd2 Used sets for CheckRegistry.registered_checks and deployment_checks. 2017-08-24 10:37:50 -04:00
Sergey Fedoseev 30eb92fc11 Removed need for hasattr(check, 'tags') in CheckRegistry.
It was needed to pass tests because registered checks weren't properly mocked.
2017-08-21 15:34:20 -04:00
Sergey Fedoseev 6de2930078 Fixed #28360 -- Fixed test runner crash with --debug-sql on fail/error in subTest. 2017-07-05 16:56:24 -04:00
Mads Jensen 550cb3a365 Fixed #27818 -- Replaced try/except/pass with contextlib.suppress(). 2017-06-28 14:07:55 -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
François Freitag 98b3b14a64 Fixed #28203 -- Ignored connection configuration queries in assertNumQueries(). 2017-05-18 11:48:03 -04:00
João Silva 3db84b5526 Fixed #28081 -- Stopped setting Content-Length=0 in conditional_content_removal() per RFC 7230. 2017-05-09 14:55:03 -04:00
Tim Graham 60dce33ab1 Removed obsolete django.test.utils.strip_quotes().
Django's test runners no longer discover doctests.
2017-04-27 20:32:12 -04:00
Jon Dufresne 7be94e0335 Replaced set |= operator with update() to avoid temporary set. 2017-04-27 08:16:19 -04:00
Jon Dufresne 7bbb5161ea Removed implicit default store_true/false argparse args.
argparse automatically sets the default value for store_true/false
arguments to its opposite.
2017-04-01 20:03:56 -04:00
Claude Paroz 145f6c3ed6 Refs #27622 -- Fixed a regression in JSON content-type detection
A JSON Content-Type can contain further content, like charset for example.
2017-03-07 16:44:15 +01:00
Anton Samarchyan 86de930f41 Refs #27656 -- Updated remaining docstring verbs according to PEP 257. 2017-03-04 10:02:06 -05:00
Chris Lamb 339d526d55 Fixed #27873 -- Fixed crash in setup_test_environment() if ALLOWED_HOSTS is a tuple.
Regression in 17e661641d
2017-02-24 13:58:56 -05:00
Vytis Banaitis 3dcc351691 Refs #23919 -- Used yield from. 2017-02-23 20:06:01 -05:00
Tim Graham 3f5a35d6e2 Added TransactionTestCase.multi_db instead of using getattr(). 2017-02-13 08:46:00 -05:00
Nadège Michel bece837829 Fixed #20238 -- Added threading support to LiveServerTestCase. 2017-02-09 19:08:32 -05:00
Chronial 03281d8fe7 Fixed #26005 -- Fixed some percent decoding cases in uri_to_iri(). 2017-02-09 09:22:00 -05:00
Tim Graham 500532c95d Refs #23919 -- Removed default 'utf-8' argument for str.encode()/decode(). 2017-02-09 09:03:47 -05:00
Vytis Banaitis 8838d4dd49 Refs #23919 -- Replaced kwargs.pop() with keyword-only arguments. 2017-02-01 11:41:56 -05:00
Vytis Banaitis d1bab24e01 Refs #23919, #27778 -- Removed obsolete mentions of unicode. 2017-01-26 08:19:27 -05:00
Tim Graham 1c466994d9 Refs #23919 -- Removed misc Python 2/3 references. 2017-01-25 13:59:25 -05:00
chillaranand d6eaf7c018 Refs #23919 -- Replaced super(ClassName, self) with super(). 2017-01-25 12:23:46 -05:00