summaryrefslogtreecommitdiff
path: root/tests/utils_tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-02-14 19:47:07 -0500
committerTim Graham <timograham@gmail.com>2015-02-17 19:05:31 -0500
commit2aa06e439a29a1c24fa03744395cc57787e7198e (patch)
tree81b1a3e9bd7ef374521fc46be17d15e1f50a37c5 /tests/utils_tests
parent09da1b465ea8ba9ecb99b1cd02a689bb831d0e1b (diff)
[1.8.x] Refs #24324 -- Fixed Python 2 test failures when path to Django source contains non-ASCII characters.
Backport of 307c0f299a6c26f5231d3516df5b4edc54b36553 from master
Diffstat (limited to 'tests/utils_tests')
-rw-r--r--tests/utils_tests/test_autoreload.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py
index 3b7135ee77..3fd5e426e3 100644
--- a/tests/utils_tests/test_autoreload.py
+++ b/tests/utils_tests/test_autoreload.py
@@ -5,7 +5,7 @@ from importlib import import_module
from django import conf
from django.contrib import admin
from django.test import TestCase, override_settings
-from django.utils._os import upath
+from django.utils._os import npath, upath
from django.utils.autoreload import gen_filenames
LOCALE_PATH = os.path.join(os.path.dirname(__file__), 'locale')
@@ -58,9 +58,10 @@ class TestFilenameGenerator(TestCase):
Test that gen_filenames also yields from locale dirs in installed apps.
"""
filenames = list(gen_filenames())
- self.assertIn(os.path.join(os.path.dirname(admin.__file__), 'locale',
- 'nl', 'LC_MESSAGES', 'django.mo'),
- filenames)
+ self.assertIn(
+ os.path.join(os.path.dirname(upath(admin.__file__)), 'locale', 'nl', 'LC_MESSAGES', 'django.mo'),
+ filenames
+ )
@override_settings(USE_I18N=False)
def test_no_i18n(self):
@@ -70,9 +71,9 @@ class TestFilenameGenerator(TestCase):
"""
filenames = list(gen_filenames())
self.assertNotIn(
- os.path.join(os.path.dirname(conf.__file__), 'locale', 'nl',
- 'LC_MESSAGES', 'django.mo'),
- filenames)
+ os.path.join(os.path.dirname(upath(conf.__file__)), 'locale', 'nl', 'LC_MESSAGES', 'django.mo'),
+ filenames
+ )
def test_only_new_files(self):
"""
@@ -91,7 +92,7 @@ class TestFilenameGenerator(TestCase):
try:
_, filename = os.path.split(filepath)
import_module('.%s' % filename.replace('.py', ''), package='utils_tests')
- self.assertIn(filepath, gen_filenames())
+ self.assertIn(npath(filepath), gen_filenames())
finally:
os.close(fd)
os.remove(filepath)