summaryrefslogtreecommitdiff
path: root/tests/servers
AgeCommit message (Collapse)Author
2026-03-30Refs #36770 -- Skipped test_in_memory_database_lock().Jacob Walls
Skip pending some investigation.
2026-03-30Refs #36770 -- Preferred addCleanup() in live server tests.Jacob Walls
2025-10-20Fixed #36470 -- Prevented log injection in runserver when handling NOT FOUND.YashRaj1506
Migrated `WSGIRequestHandler.log_message()` to use a more robust `log_message()` helper, which was based of `log_response()` via factoring out the common bits. Refs CVE-2025-48432. Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2025-07-23Refs #36500 -- Rewrapped long docstrings and block comments via a script.django-bot
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
2025-03-11Fixed #36177 -- Added a trailing newline to JSON serializer. (#19232)Tom Carrick
2024-01-26Applied Black's 2024 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/24.1.0
2023-12-31Fixed #35051 -- Prevented runserver from removing non-zero Content-Length ↵Paul Bailey
for HEAD requests.
2023-08-23Fixed ResourceWarning from unclosed SQLite connection on Python 3.13+.Mariusz Felisiak
- backends.sqlite.tests.ThreadSharing.test_database_sharing_in_threads - backends.tests.ThreadTests.test_default_connection_thread_local: on SQLite, close() doesn't explicitly close in-memory connections. - servers.tests.LiveServerInMemoryDatabaseLockTest - test_runner.tests.SQLiteInMemoryTestDbs.test_transaction_support Check out https://github.com/python/cpython/pull/108015.
2023-02-01Refs #33476 -- Applied Black's 2023 stable style.David Smith
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-01-27Fixed #28054 -- Made runserver not return response body for HEAD requests.Sarah Boyce
Co-authored-by: jannschu <jannik.schuerg@posteo.de>
2023-01-12Fixed thread termination in servers.tests.LiveServerPort on Python 3.10.9+, ↵Mariusz Felisiak
3.11.1+, and 3.12+. Class cleanups registered in TestCase subclasses are no longer called as TestCase.doClassCleanups() only cleans up the particular class, see https://github.com/python/cpython/commit/c2102136be569e6fc8ed90181f229b46d07142f8
2022-11-24Fixed #29062 -- Prevented possibility of database lock when using ↵baldychristophe
LiveServerTestCase with in-memory SQLite database. Thanks Chris Jerdonek for the implementation idea.
2022-10-08Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to ↵Gregor Gärtner
assertQuerySetEqual(). Co-Authored-By: Michael Howitz <mh@gocept.com>
2022-04-14Relaxed some query ordering assertions in various tests.Mariusz Felisiak
It accounts for differences seen on MySQL with MyISAM storage engine.
2022-03-08Rewrote some references to "master".Adam Johnson
Following d9a266d657f66b8c4fa068408002a4e3709ee669.
2022-02-22Removed redundant QuerySet.all() calls in docs and tests.Nick Pope
Most QuerySet methods are mapped onto the Manager and, in general, it isn't necessary to call .all() on the manager.
2022-02-14Refs #25684 -- Removed double newline from request/response output of runserver.rafrafek
Follow up to 0bc5cd628042bf0a44df60a93085a4f991a84dfb.
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-10-26Fixed #27079 -- Avoided multiple setUpClass()/tearDownClass() calls in ↵Jacob Walls
LiveServerTestCase tests.
2021-10-25Fixed typo in tests/servers/tests.py.Jacob Walls
2021-10-18Refs #32956 -- Changed docs to treat the acronym HTTP phonetically.David Smith
2021-04-12Fixed #32416 -- Made ThreadedWSGIServer close connections after each thread.Chris Jerdonek
ThreadedWSGIServer is used by LiveServerTestCase.
2021-02-23Fixed #32445 -- Fixed LiveServerThreadTest.test_closes_connections() for ↵Chris Jerdonek
non-in-memory database on SQLite.
2021-02-12Fixed #32437 -- Fixed cleaning up ALLOWED_HOSTS in LiveServerTestCase on ↵Chris Jerdonek
setUpClass() failure.
2021-02-12Refs #32416 -- Added LiveServerThread.server_class to ease subclassing.Chris Jerdonek
2021-02-06Refs #32394 -- Changed STATIC_URL/MEDIA_URL to relative paths in tests and ↵Markus Holtermann
docs where appropriate.
2020-12-15Fixed typo in tests/servers/tests.py.Mariusz Felisiak
2020-12-14Fixed #32240 -- Made runserver suppress ↵Petter Strandmark
ConnectionAbortedError/ConnectionResetError errors. See https://bugs.python.org/issue27682 and https://github.com/python/cpython/pull/9713
2020-12-14Refs #4444 -- Added tests for handling broken pipe errors in WSGIServer.Petter Strandmark
2020-12-10Fixed #32178 -- Allowed database backends to skip tests and mark expected ↵Hasan Ramezani
failures. Co-authored-by: Tim Graham <timograham@gmail.com>
2019-11-18Replaced unnecessary str()/bytes() calls with literals.Jon Dufresne
2019-07-10Fixed #30619 -- Made runserver --nothreading use single threaded WSGIServer.atsuo ishimoto
Browsers often use multiple connections with Connection: keep-alive. If --nothreading is specified, the WSGI server cannot accept new connections until the old connection is closed, causing hangs. Force Connection: close when --nothreading option is used.
2019-02-14Fixed #30171 -- Fixed DatabaseError in servers tests.Jon Dufresne
Made DatabaseWrapper thread sharing logic reentrant. Used a reference counting like scheme to allow nested uses. The error appeared after 8c775391b78b2a4a2b57c5e89ed4888f36aada4b.
2019-02-09Removed default empty content argument from HttpResponse calls.Jon Dufresne
2019-01-28Fixed #30137 -- Replaced OSError aliases with the canonical OSError.Jon Dufresne
Used more specific errors (e.g. FileExistsError) as appropriate.
2019-01-10Refs #28478 -- Deprecated TestCase's allow_database_queries and multi_db in ↵Simon Charette
favor of databases.
2018-12-31Updated test URL patterns to use path() and re_path().Tim Graham
2018-12-19Fixed #30015 -- Ensured request body is properly consumed for keep-alive ↵Konstantin Alekseev
connections.
2018-11-27Made reused RequestFactory instances class attributes.Simon Charette
2018-11-10Fixed keep-alive support in manage.py runserver.Florian Apolloner
Ticket #25619 changed the default protocol to HTTP/1.1 but did not properly implement keep-alive. As a "fix" keep-alive was disabled in ticket #28440 to prevent clients from hanging (they expect the server to send more data if the connection is not closed and there is no content length set). The combination of those two fixes resulted in yet another problem: HTTP/1.1 by default allows a client to assume that keep-alive is supported unless the server disables it via 'Connection: close' -- see RFC2616 8.1.2.1 for details on persistent connection negotiation. Now if the client receives a response from Django without 'Connection: close' and immediately sends a new request (on the same tcp connection) before our server closes the tcp connection, it will error out at some point because the connection does get closed a few milli seconds later. This patch fixes the mentioned issues by always sending 'Connection: close' if we cannot determine a content length. The code is inefficient in the sense that it does not allow for persistent connections when chunked responses are used, but that should not really cause any problems (Django does not generate those) and it only affects the development server anyways. Refs #25619, #28440.
2018-05-07Captured logging in tests with self.assertLogs().Claude Paroz
2018-05-07Replaced django.test.utils.patch_logger() with assertLogs().Claude Paroz
Thanks Tim Graham for the review.
2017-10-13Refs #28440 -- Fixed server connection closing test on macOS.Tom
2017-09-25Fixed #27857 -- Dropped support for Python 3.4.Tim Graham
2017-09-12Fixed #28440 -- Fixed WSGIServer hang on responses without a Content-Length.Tom
Disabled keep-alive to fix the regression in e6065c7b8363202c5eb13ba10c97a8c24d014b45.
2017-06-05Fixed ResourceWarnings in tests/servers/tests.py.Jon Dufresne
e.g. ResourceWarning: unclosed <socket.socket [closed] fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>
2017-05-30Fixed #28212 -- Allowed customizing the port that LiveServerTestCase uses.Robert Rollins
Forwardport of 877d7b71ae952b3bc946e5187d6c23039a71614d from stable/1.11.x
2017-05-27Fixed #28249 -- Removed unnecessary dict.keys() calls.Jon Dufresne
iter(dict) is equivalent to iter(dict.keys()).
2017-05-10Decreased max_length for char fields unless absolutely needed. (#8485)Florian Apolloner
2017-02-23Fixed #25619 -- Made runserver serve with HTTP 1.1 protocolClaude Paroz
Thanks Tim Graham for the review.