mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #23930 -- Added copies of captured_std* managers from CPython's test.support.
StringIO import was adapted for compatibility with Python 2.
This commit is contained in:
parent
c8dcded930
commit
6dbe979b4d
7 changed files with 76 additions and 60 deletions
|
@ -1,10 +1,9 @@
|
|||
import sys
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.core.servers.basehttp import WSGIRequestHandler
|
||||
from django.test import TestCase
|
||||
from django.test.client import RequestFactory
|
||||
from django.utils.six import BytesIO, StringIO
|
||||
from django.test.utils import captured_stderr
|
||||
from django.utils.six import BytesIO
|
||||
|
||||
|
||||
class WSGIRequestHandlerTestCase(TestCase):
|
||||
|
@ -14,14 +13,10 @@ class WSGIRequestHandlerTestCase(TestCase):
|
|||
|
||||
handler = WSGIRequestHandler(request, '192.168.0.2', None)
|
||||
|
||||
_stderr = sys.stderr
|
||||
sys.stderr = StringIO()
|
||||
try:
|
||||
with captured_stderr() as stderr:
|
||||
handler.log_message("GET %s %s", str('\x16\x03'), "4")
|
||||
self.assertIn(
|
||||
"You're accessing the developement server over HTTPS, "
|
||||
"but it only supports HTTP.",
|
||||
sys.stderr.getvalue()
|
||||
stderr.getvalue()
|
||||
)
|
||||
finally:
|
||||
sys.stderr = _stderr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue