mirror of
https://github.com/django/django.git
synced 2025-11-01 12:25:37 +00:00
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>
This commit is contained in:
parent
ed244199c7
commit
a0f8c52ae2
2 changed files with 10 additions and 6 deletions
|
|
@ -29,11 +29,12 @@ def subview(request):
|
|||
|
||||
|
||||
def subview_calling_view(request):
|
||||
response = urlopen(request.GET['url'] + '/subview/')
|
||||
return HttpResponse('subview calling view: {}'.format(response.read().decode()))
|
||||
with urlopen(request.GET['url'] + '/subview/') as response:
|
||||
return HttpResponse('subview calling view: {}'.format(response.read().decode()))
|
||||
|
||||
|
||||
def check_model_instance_from_subview(request):
|
||||
urlopen(request.GET['url'] + '/create_model_instance/')
|
||||
response = urlopen(request.GET['url'] + '/model_view/')
|
||||
return HttpResponse('subview calling view: {}'.format(response.read().decode()))
|
||||
with urlopen(request.GET['url'] + '/create_model_instance/'):
|
||||
pass
|
||||
with urlopen(request.GET['url'] + '/model_view/') as response:
|
||||
return HttpResponse('subview calling view: {}'.format(response.read().decode()))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue