mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
[py3] Updated urllib/urllib2/urlparse imports.
Lots of functions were moved. Use explicit imports in all cases to keey it easy to identify where the functions come from.
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
Tests for django.core.servers.
|
||||
"""
|
||||
import os
|
||||
import urllib2
|
||||
try:
|
||||
from urllib.request import urlopen, HTTPError
|
||||
except ImportError: # Python 2
|
||||
from urllib2 import urlopen, HTTPError
|
||||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.test import LiveServerTestCase
|
||||
@@ -39,7 +42,7 @@ class LiveServerBase(LiveServerTestCase):
|
||||
super(LiveServerBase, cls).tearDownClass()
|
||||
|
||||
def urlopen(self, url):
|
||||
return urllib2.urlopen(self.live_server_url + url)
|
||||
return urlopen(self.live_server_url + url)
|
||||
|
||||
|
||||
class LiveServerAddress(LiveServerBase):
|
||||
@@ -102,7 +105,7 @@ class LiveServerViews(LiveServerBase):
|
||||
"""
|
||||
try:
|
||||
self.urlopen('/')
|
||||
except urllib2.HTTPError as err:
|
||||
except HTTPError as err:
|
||||
self.assertEqual(err.code, 404, 'Expected 404 response')
|
||||
else:
|
||||
self.fail('Expected 404 response')
|
||||
|
||||
Reference in New Issue
Block a user