Refs #23919 -- Removed django.utils._os.upath()/npath()/abspathu() usage.

These functions do nothing on Python 3.
This commit is contained in:
Tim Graham 2017-01-20 08:01:02 -05:00 committed by GitHub
parent ec4c1d6717
commit 4e729feaa6
64 changed files with 108 additions and 178 deletions

View file

@ -26,10 +26,9 @@ from django.db.migrations.recorder import MigrationRecorder
from django.test import (
LiveServerTestCase, SimpleTestCase, TestCase, mock, override_settings,
)
from django.utils._os import npath, upath
from django.utils.encoding import force_text
custom_templates_dir = os.path.join(os.path.dirname(upath(__file__)), 'custom_templates')
custom_templates_dir = os.path.join(os.path.dirname(__file__), 'custom_templates')
PY36 = sys.version_info >= (3, 6)
SYSTEM_CHECK_MSG = 'System check identified no issues'
@ -128,7 +127,7 @@ class AdminScriptTestCase(unittest.TestCase):
def run_test(self, script, args, settings_file=None, apps=None):
base_dir = os.path.dirname(self.test_dir)
# The base dir for Django's tests is one level up.
tests_dir = os.path.dirname(os.path.dirname(upath(__file__)))
tests_dir = os.path.dirname(os.path.dirname(__file__))
# The base dir for Django is one level above the test dir. We don't use
# `import django` to figure that out, so we don't pick up a Django
# from site-packages or similar.
@ -152,7 +151,7 @@ class AdminScriptTestCase(unittest.TestCase):
python_path = [base_dir, django_dir, tests_dir]
python_path.extend(ext_backend_base_dirs)
# Use native strings for better compatibility
test_environ[str(python_path_var_name)] = npath(os.pathsep.join(python_path))
test_environ[str(python_path_var_name)] = os.pathsep.join(python_path)
test_environ[str('PYTHONWARNINGS')] = str('')
# Move to the test directory and run
@ -168,7 +167,7 @@ class AdminScriptTestCase(unittest.TestCase):
return out, err
def run_django_admin(self, args, settings_file=None):
script_dir = os.path.abspath(os.path.join(os.path.dirname(upath(django.__file__)), 'bin'))
script_dir = os.path.abspath(os.path.join(os.path.dirname(django.__file__), 'bin'))
return self.run_test(os.path.join(script_dir, 'django-admin.py'), args, settings_file)
def run_manage(self, args, settings_file=None):
@ -178,7 +177,7 @@ class AdminScriptTestCase(unittest.TestCase):
except OSError:
pass
conf_dir = os.path.dirname(upath(conf.__file__))
conf_dir = os.path.dirname(conf.__file__)
template_manage_py = os.path.join(conf_dir, 'project_template', 'manage.py-tpl')
test_manage_py = os.path.join(self.test_dir, 'manage.py')

View file

@ -1,10 +1,9 @@
import os
from django.conf.urls import url
from django.utils._os import upath
from django.views.static import serve
here = os.path.dirname(upath(__file__))
here = os.path.dirname(__file__)
urlpatterns = [
url(r'^custom_templates/(?P<path>.*)$', serve, {