Commit Graph

150 Commits

Author SHA1 Message Date
Mariusz Felisiak 6f7c0a4d66
Fixed ResourceWarning from unclosed SQLite connection in test_utils on Python 3.13+.
On SQLite, close() doesn't explicitly close in-memory connections.

Follow up to 921670c694 and
dd45d5223b.
2024-03-20 11:44:30 +01:00
Mariusz Felisiak 5f637a8a8d
Fixed #35226 -- Reallowed executing queries for dynamically created connections.
Regression in 8fb0be3500.

Thanks Florian Apolloner for the report.
2024-02-19 18:34:18 +01:00
Mariusz Felisiak 9350308f37
Fixed closing connections in test_utils.tests.AllowedDatabaseQueriesTests. 2024-02-19 14:08:30 +01:00
Daniel Garcia Moreno bc8471f0aa Refs #34900, Refs #34118 -- Updated assertion in test_skip_class_unless_db_feature() test on Python 3.12.2+.
Python 3.12.2 bring back the skipped tests in the number of running
tests. Refs
0a737639dc
2024-02-10 16:14:51 +01:00
Florian Apolloner 6e520d9537 Avoided nested transactions in SkippingClassTestCase. 2024-01-12 09:57:52 +01:00
David Wobrock 8fb0be3500 Fixed #33277 -- Disallowed database connections in threads in SimpleTestCase. 2024-01-03 13:02:26 +01:00
Nicolas Lupien 2bf46c3825 Fixed #34658 -- Added SimpleTestCase.assertNotInHTML(). 2023-12-22 08:27:59 +01:00
Mariusz Felisiak 20b7aac7ca
Refs #34900, Refs #34118 -- Updated assertion in test_skip_class_unless_db_feature() test on Python 3.12.1+.
Python 3.12.1+ no longer includes skipped tests in the number of
running tests. Check out:

https://github.com/python/cpython/issues/110890#issuecomment-1763458686
https://github.com/python/cpython/pull/106588
2023-10-16 06:27:27 +02:00
Chinmoy Chakraborty 1dae65dc63 Fixed #34657 -- Made assert(Not)Contains/assertInHTML display haystacks in error messages. 2023-10-03 10:44:36 +02:00
Mariusz Felisiak 679212a47a
Refs #34657 -- Made msg_prefix handling in assertURLEqual()/assertInHTML consistent with other assertions.
Co-authored-by: Chinmoy Chakraborty <chinmoy12c@gmail.com>
2023-10-03 09:25:48 +02:00
Chinmoy Chakraborty e99c7d8847 Refs #34657 -- Made assertInHTML() use unparsed needle in error messages. 2023-09-29 09:52:39 +02:00
Arian 51d703a27f Fixed #34823 -- Fixed assertTemplateUsed() context manager crash on unnamed templates. 2023-09-22 10:51:10 +02:00
Mariusz Felisiak 69af3bea99 Refs #33990 -- Removed TransactionTestCase.assertQuerysetEqual() per deprecation timeline. 2023-09-18 22:12:40 +02:00
Mariusz Felisiak c35fd9e275 Refs #33990 -- Removed SimpleTestCase.assertFormsetError() per deprecation timeline. 2023-09-18 22:12:40 +02:00
David Smith 1d0dfc0b92 Refs #30686 -- Moved Parser.SELF_CLOSING_TAGS to django.utils.html.VOID_ELEMENTS 2023-07-14 10:25:00 +02:00
David Smith 097e3a70c1 Refs #33476 -- Applied Black's 2023 stable style.
Black 23.1.0 is released which, as the first release of the year,
introduces the 2023 stable style. This incorporates most of last year's
preview style.

https://github.com/psf/black/releases/tag/23.1.0
2023-02-01 11:04:38 +01:00
Mariusz Felisiak 3bbe22dafc
Fixed #34233 -- Dropped support for Python 3.8 and 3.9. 2023-01-18 09:46:01 +01:00
Mariusz Felisiak 71d1203b07 Refs #33348 -- Removed support for passing response object and form/formset name to SimpleTestCase.assertFormError()/assertFormSetError().
Per deprecation timeline.
2023-01-17 11:49:15 +01:00
Mariusz Felisiak 23c8787439 Refs #33348 -- Removed support for passing errors=None to SimpleTestCase.assertFormError()/assertFormsetErrors().
Per deprecation timeline.
2023-01-17 11:49:15 +01:00
Jarosław Wygoda 32940d390a Refs #26029 -- Deprecated DEFAULT_FILE_STORAGE and STATICFILES_STORAGE settings. 2023-01-12 09:58:36 +01:00
Christophe Baldy 70c945d6b3
Used DatabaseFeatures.django_test_skips to skip AssertNumQueriesUponConnectionTests tests. 2022-11-24 19:41:08 +01:00
Gregor Gärtner f0c06f8ab7 Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to assertQuerySetEqual().
Co-Authored-By: Michael Howitz <mh@gocept.com>
2022-10-08 08:07:38 +02:00
Gregor Gärtner 564b317fb5 Refs #33990 -- Renamed SimpleTestCase.assertFormsetError() to assertFormSetError().
Co-Authored-By: Michael Howitz <mh@gocept.com>
2022-10-07 11:22:16 +02:00
SirAbhi13 4a1150b41d Fixed #33616 -- Allowed registering callbacks that can fail in transaction.on_commit().
Thanks David Wobrock and Mariusz Felisiak for reviews.
2022-09-06 12:21:36 +02:00
zhangyangyu 1bb9bd9724 Fixed #33633 -- Skipped some test_utils tests on databases that don't support transactions. 2022-04-12 13:37:44 +02:00
Mariusz Felisiak 2ee4caf56b
Refs #33173 -- Fixed test_runner/test_utils tests on Python 3.11+.
Python 3.11 uses fully qualified test name in unittest output. See
755be9b150
2022-04-07 07:02:21 +02:00
Baptiste Mispelon 50e1e7ef8e Fixed #33348 -- Changed SimpleTestCase.assertFormError()/assertFormsetErrors() to take form/formset.
Instead of taking a response object and a context name for
the form/formset, the two methods now take the object directly.
2022-04-06 07:58:52 +02:00
Mariusz Felisiak 1a7d75cf77
Moved remaining SimpleTestCase.assertFormError()/assertFormsetErrors() tests to test_utils.
This also removes redundant tests in test_client_regress.

Follow up to 68144f4049.
2022-04-05 08:37:28 +02:00
Adam Johnson a8c15481f4 Rewrote some references to "master".
Following d9a266d657.
2022-03-08 14:50:06 +01:00
Nick Pope 847f46e9bf
Removed redundant QuerySet.all() calls in docs and tests.
Most QuerySet methods are mapped onto the Manager and, in general,
it isn't necessary to call .all() on the manager.
2022-02-22 10:29:38 +01:00
Baptiste Mispelon f7e0bffa2e Refs #33348 -- Made SimpleTestCase.assertFormError() raise ValueError when "field" is passed without "form_index". 2022-02-15 10:30:20 +01:00
Mariusz Felisiak d4c9dab74b Refs #33348 -- Fixed SimpleTestCase.assertFormError() error message raised for unbound forms. 2022-02-15 10:16:06 +01:00
Baptiste Mispelon d84cd91e90 Refs #33348 -- Improved messages raised by SimpleTestCase.assertFormError()/assertFormsetErrors().
This makes messages use BaseFormSet/BaseForm.__repr__() instead of
context, and adds the _assert_form_error() helper.
2022-02-15 07:15:44 +01:00
Baptiste Mispelon 9bb13def5d Refs #33348 -- Made SimpleTestCase.assertFormsetErrors() raise an error when form_index is too big. 2022-02-14 12:46:46 +01:00
Baptiste Mispelon 7986028e3f Refs #33348 -- Made SimpleTestCase.assertFormError()/assertFormsetErrors() raise an error for unbound forms/formsets. 2022-02-14 08:43:46 +01:00
Mariusz Felisiak 7119f40c98 Refs #33476 -- Refactored code to strictly match 88 characters line length. 2022-02-07 20:37:05 +01:00
django-bot 9c19aff7c7 Refs #33476 -- Reformatted code with Black. 2022-02-07 20:37:05 +01:00
Mariusz Felisiak c5cd878382
Refs #33476 -- Refactored problematic code before reformatting by Black.
In these cases Black produces unexpected results, e.g.

def make_random_password(
    self,
    length=10,
    allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789',
):

or

cursor.execute("""
SELECT ...
""",
    [table name],
)
2022-02-03 11:20:46 +01:00
Baptiste Mispelon c67e1cf44f Refs #33348 -- Deprecated passing errors=None to SimpleTestCase.assertFormError()/assertFormsetErrors(). 2022-01-06 17:29:32 +01:00
Petter Friberg bc174e6ea0 Fixed #33410 -- Fixed recursive capturing of callbacks by TestCase.captureOnCommitCallbacks().
Regression in d89f976bdd.
2022-01-06 06:38:17 +01:00
Ad Timmering 806efe912b Fixed #33400 -- Added support for msg_prefix and count arguments to assertTemplateUsed()/assertTemplateNotUsed() used as context managers. 2022-01-05 12:49:42 +01:00
Baptiste Mispelon cb383753c0 Fixed #33346 -- Fixed SimpleTestCase.assertFormsetError() crash on a formset named "form".
Thanks OutOfFocus4 for the report.

Regression in 456466d932.
2021-12-08 20:33:03 +01:00
Baptiste Mispelon 9ac92b1efc Refs #33301 -- Made SimpleTestCase.assertFormError()/assertFormsetErrors() raise ValueError for non test client responses. 2021-11-26 13:10:43 +01:00
Baptiste Mispelon 68144f4049 Added tests for SimpleTestCase.assertFormError()/assertFormsetErrors(). 2021-11-26 12:36:25 +01:00
SwastikTripathi 76f07b4fcf Fixed #33278 -- Improved error for connection/query attempts against disallowed databases in tests. 2021-11-15 11:46:10 +01:00
Pratyush Mittal f38458fe56 Fixed #33236 -- Fixed assertHTMLEqual() error messages for escaped HTML. 2021-10-29 12:09:23 +02:00
Mariusz Felisiak e2be307b3a Refs #31235 -- Made assertQuerysetEqual() not call repr() on a queryset when compared to string values.
Per deprecation timeline.
2021-09-20 21:23:01 +02:00
Eugene Morozov d89f976bdd Fixed #33054 -- Made TestCase.captureOnCommitCallbacks() capture callbacks recursively. 2021-08-30 07:06:22 +02:00
Baptiste Mispelon 41e6b2a3c5 Fixed #32556 -- Fixed handling empty string as non-boolean attributes value by assertHTMLEqual(). 2021-03-19 20:41:57 +01:00
Hasan Ramezani 9bf5e9418f Fixed #32556 -- Fixed assertHTMLEqual() to handle empty string as boolean attributes value. 2021-03-18 16:30:15 +01:00