Mariusz Felisiak
dd45d5223b
Fixed ResourceWarning from unclosed SQLite connection on Python 3.13+.
...
- 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-08-23 09:09:23 +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
Sarah Boyce
8acc433e41
Fixed #28054 -- Made runserver not return response body for HEAD requests.
...
Co-authored-by: jannschu <jannik.schuerg@posteo.de>
2023-01-27 21:49:54 +01:00
Mariusz Felisiak
d02a9f0cee
Fixed thread termination in servers.tests.LiveServerPort on Python 3.10.9+, 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
c2102136be
2023-01-12 06:04:10 +01:00
baldychristophe
855f5a36e7
Fixed #29062 -- Prevented possibility of database lock when using LiveServerTestCase with in-memory SQLite database.
...
Thanks Chris Jerdonek for the implementation idea.
2022-11-24 10:52:48 +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
Mariusz Felisiak
1760ad4e8c
Relaxed some query ordering assertions in various tests.
...
It accounts for differences seen on MySQL with MyISAM storage engine.
2022-04-14 12:12:13 +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
rafrafek
cdd4ff67d2
Refs #25684 -- Removed double newline from request/response output of runserver.
...
Follow up to 0bc5cd6280
.
2022-02-14 06:55:34 +01:00
django-bot
9c19aff7c7
Refs #33476 -- Reformatted code with Black.
2022-02-07 20:37:05 +01:00
Jacob Walls
def09bf412
Fixed #27079 -- Avoided multiple setUpClass()/tearDownClass() calls in LiveServerTestCase tests.
2021-10-26 07:47:40 +02:00
Jacob Walls
1feb55d607
Fixed typo in tests/servers/tests.py.
2021-10-25 07:42:06 +02:00
David Smith
69b0736fad
Refs #32956 -- Changed docs to treat the acronym HTTP phonetically.
2021-10-18 21:00:28 +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
5c4c3e2d1f
Fixed #32445 -- Fixed LiveServerThreadTest.test_closes_connections() for non-in-memory database on SQLite.
2021-02-23 06:08:43 +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
Markus Holtermann
50a5f8840f
Refs #32394 -- Changed STATIC_URL/MEDIA_URL to relative paths in tests and docs where appropriate.
2021-02-06 13:41:35 +01:00
Mariusz Felisiak
965d2d95c6
Fixed typo in tests/servers/tests.py.
2020-12-15 08:51:58 +01:00
Petter Strandmark
772eca0b02
Fixed #32240 -- Made runserver suppress ConnectionAbortedError/ConnectionResetError errors.
...
See https://bugs.python.org/issue27682 and
https://github.com/python/cpython/pull/9713
2020-12-14 20:46:18 +01:00
Petter Strandmark
28124e7bdf
Refs #4444 -- Added tests for handling broken pipe errors in WSGIServer.
2020-12-14 20:46:18 +01:00
Hasan Ramezani
275dd4ebba
Fixed #32178 -- Allowed database backends to skip tests and mark expected failures.
...
Co-authored-by: Tim Graham <timograham@gmail.com>
2020-12-10 18:00:57 +01:00
Jon Dufresne
57a3d96ff5
Replaced unnecessary str()/bytes() calls with literals.
2019-11-18 15:30:10 +01:00
atsuo ishimoto
a9c6ab0356
Fixed #30619 -- Made runserver --nothreading use single threaded WSGIServer.
...
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-07-10 13:22:17 +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
c492fdfd24
Removed default empty content argument from HttpResponse calls.
2019-02-09 16:27:32 -05:00
Jon Dufresne
7785e03ba8
Fixed #30137 -- Replaced OSError aliases with the canonical OSError.
...
Used more specific errors (e.g. FileExistsError) as appropriate.
2019-01-28 11:15:06 -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
043bd70942
Updated test URL patterns to use path() and re_path().
2018-12-31 10:47:32 -05:00
Konstantin Alekseev
b514dc14f4
Fixed #30015 -- Ensured request body is properly consumed for keep-alive connections.
2018-12-19 11:27:08 +01:00
Simon Charette
0f212db29d
Made reused RequestFactory instances class attributes.
2018-11-27 09:49:02 -05:00
Florian Apolloner
934acf1126
Fixed keep-alive support in manage.py runserver.
...
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-11-10 13:54:45 +01:00
Claude Paroz
523e04dfeb
Captured logging in tests with self.assertLogs().
2018-05-07 09:34:02 -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
Tom
32ade78c55
Refs #28440 -- Fixed server connection closing test on macOS.
2017-10-13 13:29:29 -04:00
Tim Graham
cfff2af02b
Fixed #27857 -- Dropped support for Python 3.4.
2017-09-25 17:11:03 -04:00
Tom
ac756f16c5
Fixed #28440 -- Fixed WSGIServer hang on responses without a Content-Length.
...
Disabled keep-alive to fix the regression in
e6065c7b83
.
2017-09-12 10:41:28 -04:00
Jon Dufresne
a0f8c52ae2
Fixed ResourceWarnings in tests/servers/tests.py.
...
e.g. ResourceWarning: unclosed <socket.socket [closed] fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>
2017-06-05 09:56:51 -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
Jon Dufresne
21046e7773
Fixed #28249 -- Removed unnecessary dict.keys() calls.
...
iter(dict) is equivalent to iter(dict.keys()).
2017-05-27 19:08:46 -04:00
Florian Apolloner
d611a89238
Decreased max_length for char fields unless absolutely needed. ( #8485 )
2017-05-10 17:33:46 +02:00
Claude Paroz
e6065c7b83
Fixed #25619 -- Made runserver serve with HTTP 1.1 protocol
...
Thanks Tim Graham for the review.
2017-02-23 09:04:53 +01:00
Nadège Michel
bece837829
Fixed #20238 -- Added threading support to LiveServerTestCase.
2017-02-09 19:08:32 -05:00
Tim Graham
500532c95d
Refs #23919 -- Removed default 'utf-8' argument for str.encode()/decode().
2017-02-09 09:03:47 -05:00
Claude Paroz
fee42fd99e
Refs #23919 -- Replaced usage of django.utils.http utilities with Python equivalents
...
Thanks Tim Graham for the review.
2017-01-26 19:49:03 +01:00
chillaranand
d6eaf7c018
Refs #23919 -- Replaced super(ClassName, self) with super().
2017-01-25 12:23:46 -05:00
Claude Paroz
042b7350a0
Refs #23919 -- Removed unneeded str() calls
2017-01-20 14:13:55 +01:00
Tim Graham
4e729feaa6
Refs #23919 -- Removed django.utils._os.upath()/npath()/abspathu() usage.
...
These functions do nothing on Python 3.
2017-01-20 08:01:02 -05:00
Simon Charette
9695b14982
Refs #23919 -- Removed str() conversion of type and method __name__.
2017-01-19 11:31:07 -05:00