Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
a7901c2e
Kaydet (Commit)
a7901c2e
authored
Agu 30, 2015
tarafından
Jakub Gocławski
Kaydeden (comit)
Tim Graham
Eyl 07, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #25328 -- Refactored LiveServerTestCase to make it extensible.
üst
b929d2d0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
testcases.py
django/test/testcases.py
+14
-5
No files found.
django/test/testcases.py
Dosyayı görüntüle @
a7901c2e
...
...
@@ -1251,8 +1251,7 @@ class LiveServerThread(threading.Thread):
# one that is free to use for the WSGI server.
for
index
,
port
in
enumerate
(
self
.
possible_ports
):
try
:
self
.
httpd
=
WSGIServer
(
(
self
.
host
,
port
),
QuietWSGIRequestHandler
)
self
.
httpd
=
self
.
_create_server
(
port
)
except
socket
.
error
as
e
:
if
(
index
+
1
<
len
(
self
.
possible_ports
)
and
e
.
errno
==
errno
.
EADDRINUSE
):
...
...
@@ -1276,6 +1275,9 @@ class LiveServerThread(threading.Thread):
self
.
error
=
e
self
.
is_ready
.
set
()
def
_create_server
(
self
,
port
):
return
WSGIServer
((
self
.
host
,
port
),
QuietWSGIRequestHandler
)
def
terminate
(
self
):
if
hasattr
(
self
,
'httpd'
):
# Stop the WSGI server
...
...
@@ -1338,9 +1340,7 @@ class LiveServerTestCase(TransactionTestCase):
except
Exception
:
msg
=
'Invalid address ("
%
s") for live server.'
%
specified_address
six
.
reraise
(
ImproperlyConfigured
,
ImproperlyConfigured
(
msg
),
sys
.
exc_info
()[
2
])
cls
.
server_thread
=
LiveServerThread
(
host
,
possible_ports
,
cls
.
static_handler
,
connections_override
=
connections_override
)
cls
.
server_thread
=
cls
.
_create_server_thread
(
host
,
possible_ports
,
connections_override
)
cls
.
server_thread
.
daemon
=
True
cls
.
server_thread
.
start
()
...
...
@@ -1352,6 +1352,15 @@ class LiveServerTestCase(TransactionTestCase):
cls
.
_tearDownClassInternal
()
raise
cls
.
server_thread
.
error
@classmethod
def
_create_server_thread
(
cls
,
host
,
possible_ports
,
connections_override
):
return
LiveServerThread
(
host
,
possible_ports
,
cls
.
static_handler
,
connections_override
=
connections_override
,
)
@classmethod
def
_tearDownClassInternal
(
cls
):
# There may not be a 'server_thread' attribute if setUpClass() for some
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment